mirror of
https://github.com/symfony/recipes.git
synced 2026-09-11 15:16:30 +03:00
Update Flex endpoint
This commit is contained in:
+2
-2
@@ -208,7 +208,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith
|
||||
| [symfony/smsense-notifier](https://packagist.org/packages/symfony/smsense-notifier) | [7.1](../../../tree/main/symfony/smsense-notifier/7.1) | `smsense-notifier`, `smsensenotifier` |
|
||||
| [symfony/smsmode-notifier](https://packagist.org/packages/symfony/smsmode-notifier) | [6.3](../../../tree/main/symfony/smsmode-notifier/6.3) | `smsmode-notifier`, `smsmodenotifier` |
|
||||
| [symfony/spot-hit-notifier](https://packagist.org/packages/symfony/spot-hit-notifier) | [5.3](../../../tree/main/symfony/spot-hit-notifier/5.3) | `spot-hit-notifier`, `spothitnotifier` |
|
||||
| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.24](../../../tree/main/symfony/stimulus-bundle/2.24) | `stimulus`, `stimulus-bundle`, `stimulusbundle` |
|
||||
| [symfony/stimulus-bundle](https://packagist.org/packages/symfony/stimulus-bundle) | [2.25](../../../tree/main/symfony/stimulus-bundle/2.25) | `stimulus`, `stimulus-bundle`, `stimulusbundle` |
|
||||
| [symfony/sweego-mailer](https://packagist.org/packages/symfony/sweego-mailer) | [7.2](../../../tree/main/symfony/sweego-mailer/7.2) | `sweego-mailer`, `sweegomailer` |
|
||||
| [symfony/sweego-notifier](https://packagist.org/packages/symfony/sweego-notifier) | [7.2](../../../tree/main/symfony/sweego-notifier/7.2) | `sweego-notifier`, `sweegonotifier` |
|
||||
| [symfony/swiftmailer-bundle](https://packagist.org/packages/symfony/swiftmailer-bundle) | [2.5](../../../tree/main/symfony/swiftmailer-bundle/2.5) | `swiftmailer`, `swiftmailer-bundle`, `swiftmailerbundle` |
|
||||
@@ -241,7 +241,7 @@ Additional recipes can be found on the [Contrib Recipes Repository](https://gith
|
||||
| [symfony/web-server-bundle](https://packagist.org/packages/symfony/web-server-bundle) | [3.3](../../../tree/main/symfony/web-server-bundle/3.3) | `server`, `web-server`, `web-server-bundle`, `webserver`, `webserverbundle` |
|
||||
| [symfony/webapp-pack](https://packagist.org/packages/symfony/webapp-pack) | [1.0](../../../tree/main/symfony/webapp-pack/1.0) | `webapp` |
|
||||
| [symfony/webhook](https://packagist.org/packages/symfony/webhook) | [7.3](../../../tree/main/symfony/webhook/7.3) | `webhook` |
|
||||
| [symfony/webpack-encore-bundle](https://packagist.org/packages/symfony/webpack-encore-bundle) | [2.1](../../../tree/main/symfony/webpack-encore-bundle/2.1) | `encore`, `ux`, `webpack`, `webpack-encore`, `webpack-encore-bundle`, `webpackencore`, `webpackencorebundle` |
|
||||
| [symfony/webpack-encore-bundle](https://packagist.org/packages/symfony/webpack-encore-bundle) | [2.2](../../../tree/main/symfony/webpack-encore-bundle/2.2) | `encore`, `ux`, `webpack`, `webpack-encore`, `webpack-encore-bundle`, `webpackencore`, `webpackencorebundle` |
|
||||
| [symfony/workflow](https://packagist.org/packages/symfony/workflow) | [3.3](../../../tree/main/symfony/workflow/3.3) | `workflow` |
|
||||
| [symfony/yunpian-notifier](https://packagist.org/packages/symfony/yunpian-notifier) | [5.4](../../../tree/main/symfony/yunpian-notifier/5.4) | `yunpian-notifier`, `yunpiannotifier` |
|
||||
| [symfony/zendesk-notifier](https://packagist.org/packages/symfony/zendesk-notifier) | [6.2](../../../tree/main/symfony/zendesk-notifier/6.2) | `zendesk-notifier`, `zendesknotifier` |
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/stimulus-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\UX\\StimulusBundle\\StimulusBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "webpack.config.js",
|
||||
"content": "\n // enables the Symfony UX Stimulus bridge (used in assets/stimulus_bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')",
|
||||
"position": "after_target",
|
||||
"target": ".splitEntryChunks()"
|
||||
},
|
||||
{
|
||||
"file": "assets/app.js",
|
||||
"content": "import './stimulus_bootstrap.js';",
|
||||
"position": "top",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "assets/stimulus_bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(import.meta.webpackContext('@symfony/stimulus-bridge/lazy-controller-loader!./controllers', {\n recursive: true,\n regExp: /\\.[jt]sx?$/,\n}));",
|
||||
"position": "top",
|
||||
"requires": "symfony/webpack-encore-bundle"
|
||||
},
|
||||
{
|
||||
"file": "assets/stimulus_bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();",
|
||||
"position": "top",
|
||||
"requires": "symfony/asset-mapper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/controllers.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"controllers\": [],",
|
||||
" \"entrypoints\": []",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/csrf_protection_controller.js": {
|
||||
"contents": [
|
||||
"const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;",
|
||||
"const tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;",
|
||||
"",
|
||||
"// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager",
|
||||
"// Use `form.requestSubmit()` to ensure that the submit event is triggered. Using `form.submit()` will not trigger the event",
|
||||
"// and thus this event-listener will not be executed.",
|
||||
"document.addEventListener('submit', function (event) {",
|
||||
" generateCsrfToken(event.target);",
|
||||
"}, true);",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie",
|
||||
"// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked",
|
||||
"document.addEventListener('turbo:submit-start', function (event) {",
|
||||
" const h = generateCsrfHeaders(event.detail.formSubmission.formElement);",
|
||||
" Object.keys(h).map(function (k) {",
|
||||
" event.detail.formSubmission.fetchRequest.headers[k] = h[k];",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted",
|
||||
"document.addEventListener('turbo:submit-end', function (event) {",
|
||||
" removeCsrfToken(event.detail.formSubmission.formElement);",
|
||||
"});",
|
||||
"",
|
||||
"export function generateCsrfToken (formElement) {",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" let csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
" let csrfToken = csrfField.value;",
|
||||
"",
|
||||
" if (!csrfCookie && nameCheck.test(csrfToken)) {",
|
||||
" csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);",
|
||||
" csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));",
|
||||
" }",
|
||||
" csrfField.dispatchEvent(new Event('change', { bubbles: true }));",
|
||||
"",
|
||||
" if (csrfCookie && tokenCheck.test(csrfToken)) {",
|
||||
" const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"export function generateCsrfHeaders (formElement) {",
|
||||
" const headers = {};",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return headers;",
|
||||
" }",
|
||||
"",
|
||||
" const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" headers[csrfCookie] = csrfField.value;",
|
||||
" }",
|
||||
"",
|
||||
" return headers;",
|
||||
"}",
|
||||
"",
|
||||
"export function removeCsrfToken (formElement) {",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" const cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';",
|
||||
"",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"/* stimulusFetch: 'lazy' */",
|
||||
"export default 'csrf-protection-controller';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/hello_controller.js": {
|
||||
"contents": [
|
||||
"import { Controller } from '@hotwired/stimulus';",
|
||||
"",
|
||||
"/*",
|
||||
" * This is an example Stimulus controller!",
|
||||
" *",
|
||||
" * Any element with a data-controller=\"hello\" attribute will cause",
|
||||
" * this controller to be executed. The name \"hello\" comes from the filename:",
|
||||
" * hello_controller.js -> \"hello\"",
|
||||
" *",
|
||||
" * Delete this file or adapt it for your use!",
|
||||
" */",
|
||||
"export default class extends Controller {",
|
||||
" connect() {",
|
||||
" this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/stimulus_bootstrap.js": {
|
||||
"contents": [
|
||||
"// register any custom, 3rd party controllers here",
|
||||
"// app.register('some_controller_name', SomeImportedController);",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "9b51a69079f3629061dfe0e5d7e20f5a9b20752c"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/webpack-encore-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\WebpackEncoreBundle\\WebpackEncoreBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/",
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"package.json": "package.json",
|
||||
"webpack.config.js": "webpack.config.js"
|
||||
},
|
||||
"gitignore": [
|
||||
"/node_modules/",
|
||||
"/%PUBLIC_DIR%/build/",
|
||||
"npm-debug.log",
|
||||
"yarn-error.log"
|
||||
],
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<5.4",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_script_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block javascripts %}",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_link_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block stylesheets %}",
|
||||
"warn_if_missing": true
|
||||
}
|
||||
],
|
||||
"post-install-output": [
|
||||
" * Install NPM and run <fg=green>npm install</>",
|
||||
"",
|
||||
" * Compile your assets for development: <fg=green>npm run dev</>",
|
||||
" ",
|
||||
" * Compile your assets for development and watch for any modifications: <fg=green>npm run watch</>",
|
||||
" ",
|
||||
" * Or start the development server: <fg=green>npm run dev-server</>",
|
||||
" ",
|
||||
" * Compile your assets for production: <fg=green>npm run build</>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/app.js": {
|
||||
"contents": [
|
||||
"/*",
|
||||
" * Welcome to your app's main JavaScript file!",
|
||||
" *",
|
||||
" * We recommend including the built version of this JavaScript file",
|
||||
" * (and its CSS file) in your base layout (base.html.twig).",
|
||||
" */",
|
||||
"",
|
||||
"// any CSS you import will output into a single css file (app.css in this case)",
|
||||
"import './styles/app.css';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/styles/app.css": {
|
||||
"contents": [
|
||||
"body {",
|
||||
" background-color: lightgray;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/packages/webpack_encore.yaml": {
|
||||
"contents": [
|
||||
"webpack_encore:",
|
||||
" # The path where Encore is building the assets - i.e. Encore.setOutputPath()",
|
||||
" output_path: '%kernel.project_dir%/public/build'",
|
||||
" # If multiple builds are defined (as shown below), you can disable the default build:",
|
||||
" # output_path: false",
|
||||
"",
|
||||
" # Set attributes that will be rendered on all script and link tags",
|
||||
" script_attributes:",
|
||||
" defer: true",
|
||||
" # Uncomment (also under link_attributes) if using Turbo Drive",
|
||||
" # https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change",
|
||||
" # 'data-turbo-track': reload",
|
||||
" # link_attributes:",
|
||||
" # Uncomment if using Turbo Drive",
|
||||
" # 'data-turbo-track': reload",
|
||||
"",
|
||||
" # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')",
|
||||
" # crossorigin: 'anonymous'",
|
||||
"",
|
||||
" # Preload all rendered script and link tags automatically via the HTTP/2 Link header",
|
||||
" # preload: true",
|
||||
"",
|
||||
" # Throw an exception if the entrypoints.json file is missing or an entry is missing from the data",
|
||||
" # strict_mode: false",
|
||||
"",
|
||||
" # If you have multiple builds:",
|
||||
" # builds:",
|
||||
" # frontend: '%kernel.project_dir%/public/frontend/build'",
|
||||
"",
|
||||
" # pass the build name as the 3rd argument to the Twig functions",
|
||||
" # {{ encore_entry_script_tags('entry1', null, 'frontend') }}",
|
||||
"",
|
||||
"framework:",
|
||||
" assets:",
|
||||
" json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'",
|
||||
"",
|
||||
"#when@prod:",
|
||||
"# webpack_encore:",
|
||||
"# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)",
|
||||
"# # Available in version 1.2",
|
||||
"# cache: true",
|
||||
"",
|
||||
"#when@test:",
|
||||
"# webpack_encore:",
|
||||
"# strict_mode: false",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"package.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"devDependencies\": {",
|
||||
" \"@babel/core\": \"^8.0.0\",",
|
||||
" \"@babel/preset-env\": \"^8.0.0\",",
|
||||
" \"@symfony/webpack-encore\": \"^7.0.0\",",
|
||||
" \"babel-plugin-polyfill-corejs3\": \"^1.0.0\",",
|
||||
" \"core-js\": \"^3.49.0\",",
|
||||
" \"regenerator-runtime\": \"^0.13.9\",",
|
||||
" \"webpack\": \"^5.82\",",
|
||||
" \"webpack-cli\": \"^7.0.0\"",
|
||||
" },",
|
||||
" \"license\": \"UNLICENSED\",",
|
||||
" \"private\": true,",
|
||||
" \"scripts\": {",
|
||||
" \"dev-server\": \"encore dev-server\",",
|
||||
" \"dev\": \"encore dev\",",
|
||||
" \"watch\": \"encore dev --watch\",",
|
||||
" \"build\": \"encore production --progress\"",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"webpack.config.js": {
|
||||
"contents": [
|
||||
"import Encore from '@symfony/webpack-encore';",
|
||||
"",
|
||||
"// Manually configure the runtime environment if not already configured yet by the \"encore\" command.",
|
||||
"// It's useful when you use tools that rely on webpack.config.js file.",
|
||||
"if (!Encore.isRuntimeEnvironmentConfigured()) {",
|
||||
" Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');",
|
||||
"}",
|
||||
"",
|
||||
"Encore",
|
||||
" // directory where compiled assets will be stored",
|
||||
" .setOutputPath('public/build/')",
|
||||
" // public path used by the web server to access the output path",
|
||||
" .setPublicPath('/build')",
|
||||
" // only needed for CDN's or subdirectory deploy",
|
||||
" //.setManifestKeyPrefix('build/')",
|
||||
"",
|
||||
" /*",
|
||||
" * ENTRY CONFIG",
|
||||
" *",
|
||||
" * Each entry will result in one JavaScript file (e.g. app.js)",
|
||||
" * and one CSS file (e.g. app.css) if your JavaScript imports CSS.",
|
||||
" */",
|
||||
" .addEntry('app', './assets/app.js')",
|
||||
"",
|
||||
" // When enabled, Webpack \"splits\" your files into smaller pieces for greater optimization.",
|
||||
" .splitEntryChunks()",
|
||||
"",
|
||||
" // will require an extra script tag for runtime.js",
|
||||
" // but, you probably want this, unless you're building a single-page app",
|
||||
" .enableSingleRuntimeChunk()",
|
||||
"",
|
||||
" /*",
|
||||
" * FEATURE CONFIG",
|
||||
" *",
|
||||
" * Enable & configure other features below. For a full",
|
||||
" * list of features, see:",
|
||||
" * https://symfony.com/doc/current/frontend.html#adding-more-features",
|
||||
" */",
|
||||
" .cleanupOutputBeforeBuild()",
|
||||
"",
|
||||
" // Displays build status system notifications to the user",
|
||||
" // .enableBuildNotifications()",
|
||||
"",
|
||||
" .enableSourceMaps(!Encore.isProduction())",
|
||||
" // enables hashed filenames (e.g. app.abc123.css)",
|
||||
" .enableVersioning(Encore.isProduction())",
|
||||
"",
|
||||
" // Configure JS and CSS minimizers",
|
||||
" // .configureJsMinimizerPlugin((options, MinimizerPlugin) => {",
|
||||
" // options.minify = MinimizerPlugin.esbuildMinify",
|
||||
" // })",
|
||||
" // .configureCssMinimizerPlugin((options, MinimizerPlugin) => {",
|
||||
" // options.minify = MinimizerPlugin.lightningCssMinify;",
|
||||
" // })",
|
||||
"",
|
||||
" // configure Babel",
|
||||
" .configureBabel((config) => {",
|
||||
" config.plugins.push(['polyfill-corejs3', { method: 'usage-global', version: '3.49' }]);",
|
||||
" })",
|
||||
"",
|
||||
" // enables Sass/SCSS support",
|
||||
" //.enableSassLoader()",
|
||||
"",
|
||||
" // uncomment if you use TypeScript",
|
||||
" //.enableTypeScriptLoader()",
|
||||
"",
|
||||
" // uncomment if you use React",
|
||||
" //.enableReactPreset()",
|
||||
"",
|
||||
" // uncomment to get integrity=\"...\" attributes on your script & link tags",
|
||||
" // requires WebpackEncoreBundle 1.4 or higher",
|
||||
" //.enableIntegrityHashes(Encore.isProduction())",
|
||||
"",
|
||||
" // uncomment if you're having problems with a jQuery plugin",
|
||||
" //.autoProvidejQuery()",
|
||||
";",
|
||||
"",
|
||||
"export default await Encore.getWebpackConfig();",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "3a870e92b23917ae95f0796a0599b1aca11d4bfd"
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -1385,7 +1385,8 @@
|
||||
"2.9",
|
||||
"2.13",
|
||||
"2.20",
|
||||
"2.24"
|
||||
"2.24",
|
||||
"2.25"
|
||||
],
|
||||
"symfony/sweego-mailer": [
|
||||
"7.2"
|
||||
@@ -1518,7 +1519,8 @@
|
||||
"1.10",
|
||||
"1.17",
|
||||
"2.0",
|
||||
"2.1"
|
||||
"2.1",
|
||||
"2.2"
|
||||
],
|
||||
"symfony/workflow": [
|
||||
"3.3"
|
||||
@@ -1736,6 +1738,12 @@
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0"
|
||||
},
|
||||
"2.25": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0"
|
||||
}
|
||||
},
|
||||
"symfony/twig-bundle": {
|
||||
@@ -1846,6 +1854,10 @@
|
||||
"2.1": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
"symfony/framework-bundle": "<5.4"
|
||||
},
|
||||
"2.2": {
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0",
|
||||
"symfony/framework-bundle": "<5.4"
|
||||
}
|
||||
},
|
||||
"symfonycasts/sass-bundle": {
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/stimulus-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\UX\\StimulusBundle\\StimulusBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<7.2",
|
||||
"symfony/security-csrf": "<7.2",
|
||||
"symfony/webpack-encore-bundle": "<2.0",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "webpack.config.js",
|
||||
"content": "\n // enables the Symfony UX Stimulus bridge (used in assets/stimulus_bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')",
|
||||
"position": "after_target",
|
||||
"target": ".splitEntryChunks()"
|
||||
},
|
||||
{
|
||||
"file": "assets/app.js",
|
||||
"content": "import './stimulus_bootstrap.js';",
|
||||
"position": "top",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "assets/stimulus_bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(import.meta.webpackContext('@symfony/stimulus-bridge/lazy-controller-loader!./controllers', {\n recursive: true,\n regExp: /\\.[jt]sx?$/,\n}));",
|
||||
"position": "top",
|
||||
"requires": "symfony/webpack-encore-bundle"
|
||||
},
|
||||
{
|
||||
"file": "assets/stimulus_bootstrap.js",
|
||||
"content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();",
|
||||
"position": "top",
|
||||
"requires": "symfony/asset-mapper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/controllers.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"controllers\": [],",
|
||||
" \"entrypoints\": []",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/csrf_protection_controller.js": {
|
||||
"contents": [
|
||||
"const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;",
|
||||
"const tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;",
|
||||
"",
|
||||
"// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager",
|
||||
"// Use `form.requestSubmit()` to ensure that the submit event is triggered. Using `form.submit()` will not trigger the event",
|
||||
"// and thus this event-listener will not be executed.",
|
||||
"document.addEventListener('submit', function (event) {",
|
||||
" generateCsrfToken(event.target);",
|
||||
"}, true);",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie",
|
||||
"// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked",
|
||||
"document.addEventListener('turbo:submit-start', function (event) {",
|
||||
" const h = generateCsrfHeaders(event.detail.formSubmission.formElement);",
|
||||
" Object.keys(h).map(function (k) {",
|
||||
" event.detail.formSubmission.fetchRequest.headers[k] = h[k];",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
"// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted",
|
||||
"document.addEventListener('turbo:submit-end', function (event) {",
|
||||
" removeCsrfToken(event.detail.formSubmission.formElement);",
|
||||
"});",
|
||||
"",
|
||||
"export function generateCsrfToken (formElement) {",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" let csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
" let csrfToken = csrfField.value;",
|
||||
"",
|
||||
" if (!csrfCookie && nameCheck.test(csrfToken)) {",
|
||||
" csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);",
|
||||
" csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));",
|
||||
" }",
|
||||
" csrfField.dispatchEvent(new Event('change', { bubbles: true }));",
|
||||
"",
|
||||
" if (csrfCookie && tokenCheck.test(csrfToken)) {",
|
||||
" const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"export function generateCsrfHeaders (formElement) {",
|
||||
" const headers = {};",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return headers;",
|
||||
" }",
|
||||
"",
|
||||
" const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" headers[csrfCookie] = csrfField.value;",
|
||||
" }",
|
||||
"",
|
||||
" return headers;",
|
||||
"}",
|
||||
"",
|
||||
"export function removeCsrfToken (formElement) {",
|
||||
" const csrfField = formElement.querySelector('input[data-controller=\"csrf-protection\"], input[name=\"_csrf_token\"]');",
|
||||
"",
|
||||
" if (!csrfField) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');",
|
||||
"",
|
||||
" if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {",
|
||||
" const cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';",
|
||||
"",
|
||||
" document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"/* stimulusFetch: 'lazy' */",
|
||||
"export default 'csrf-protection-controller';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/controllers/hello_controller.js": {
|
||||
"contents": [
|
||||
"import { Controller } from '@hotwired/stimulus';",
|
||||
"",
|
||||
"/*",
|
||||
" * This is an example Stimulus controller!",
|
||||
" *",
|
||||
" * Any element with a data-controller=\"hello\" attribute will cause",
|
||||
" * this controller to be executed. The name \"hello\" comes from the filename:",
|
||||
" * hello_controller.js -> \"hello\"",
|
||||
" *",
|
||||
" * Delete this file or adapt it for your use!",
|
||||
" */",
|
||||
"export default class extends Controller {",
|
||||
" connect() {",
|
||||
" this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/stimulus_bootstrap.js": {
|
||||
"contents": [
|
||||
"// register any custom, 3rd party controllers here",
|
||||
"// app.register('some_controller_name', SomeImportedController);",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "9b51a69079f3629061dfe0e5d7e20f5a9b20752c"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/webpack-encore-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\WebpackEncoreBundle\\WebpackEncoreBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/",
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"package.json": "package.json",
|
||||
"webpack.config.js": "webpack.config.js"
|
||||
},
|
||||
"gitignore": [
|
||||
"/node_modules/",
|
||||
"/%PUBLIC_DIR%/build/",
|
||||
"npm-debug.log",
|
||||
"yarn-error.log"
|
||||
],
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<5.4",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_script_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block javascripts %}",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_link_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block stylesheets %}",
|
||||
"warn_if_missing": true
|
||||
}
|
||||
],
|
||||
"post-install-output": [
|
||||
" * Install NPM and run <fg=green>npm install</>",
|
||||
"",
|
||||
" * Compile your assets for development: <fg=green>npm run dev</>",
|
||||
" ",
|
||||
" * Compile your assets for development and watch for any modifications: <fg=green>npm run watch</>",
|
||||
" ",
|
||||
" * Or start the development server: <fg=green>npm run dev-server</>",
|
||||
" ",
|
||||
" * Compile your assets for production: <fg=green>npm run build</>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/app.js": {
|
||||
"contents": [
|
||||
"/*",
|
||||
" * Welcome to your app's main JavaScript file!",
|
||||
" *",
|
||||
" * We recommend including the built version of this JavaScript file",
|
||||
" * (and its CSS file) in your base layout (base.html.twig).",
|
||||
" */",
|
||||
"",
|
||||
"// any CSS you import will output into a single css file (app.css in this case)",
|
||||
"import './styles/app.css';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/styles/app.css": {
|
||||
"contents": [
|
||||
"body {",
|
||||
" background-color: lightgray;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/packages/webpack_encore.yaml": {
|
||||
"contents": [
|
||||
"webpack_encore:",
|
||||
" # The path where Encore is building the assets - i.e. Encore.setOutputPath()",
|
||||
" output_path: '%kernel.project_dir%/public/build'",
|
||||
" # If multiple builds are defined (as shown below), you can disable the default build:",
|
||||
" # output_path: false",
|
||||
"",
|
||||
" # Set attributes that will be rendered on all script and link tags",
|
||||
" script_attributes:",
|
||||
" defer: true",
|
||||
" # Uncomment (also under link_attributes) if using Turbo Drive",
|
||||
" # https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change",
|
||||
" # 'data-turbo-track': reload",
|
||||
" # link_attributes:",
|
||||
" # Uncomment if using Turbo Drive",
|
||||
" # 'data-turbo-track': reload",
|
||||
"",
|
||||
" # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')",
|
||||
" # crossorigin: 'anonymous'",
|
||||
"",
|
||||
" # Preload all rendered script and link tags automatically via the HTTP/2 Link header",
|
||||
" # preload: true",
|
||||
"",
|
||||
" # Throw an exception if the entrypoints.json file is missing or an entry is missing from the data",
|
||||
" # strict_mode: false",
|
||||
"",
|
||||
" # If you have multiple builds:",
|
||||
" # builds:",
|
||||
" # frontend: '%kernel.project_dir%/public/frontend/build'",
|
||||
"",
|
||||
" # pass the build name as the 3rd argument to the Twig functions",
|
||||
" # {{ encore_entry_script_tags('entry1', null, 'frontend') }}",
|
||||
"",
|
||||
"framework:",
|
||||
" assets:",
|
||||
" json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'",
|
||||
"",
|
||||
"#when@prod:",
|
||||
"# webpack_encore:",
|
||||
"# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)",
|
||||
"# # Available in version 1.2",
|
||||
"# cache: true",
|
||||
"",
|
||||
"#when@test:",
|
||||
"# webpack_encore:",
|
||||
"# strict_mode: false",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"package.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"devDependencies\": {",
|
||||
" \"@babel/core\": \"^8.0.0\",",
|
||||
" \"@babel/preset-env\": \"^8.0.0\",",
|
||||
" \"@symfony/webpack-encore\": \"^7.0.0\",",
|
||||
" \"babel-plugin-polyfill-corejs3\": \"^1.0.0\",",
|
||||
" \"core-js\": \"^3.49.0\",",
|
||||
" \"regenerator-runtime\": \"^0.13.9\",",
|
||||
" \"webpack\": \"^5.82\",",
|
||||
" \"webpack-cli\": \"^7.0.0\"",
|
||||
" },",
|
||||
" \"license\": \"UNLICENSED\",",
|
||||
" \"private\": true,",
|
||||
" \"scripts\": {",
|
||||
" \"dev-server\": \"encore dev-server\",",
|
||||
" \"dev\": \"encore dev\",",
|
||||
" \"watch\": \"encore dev --watch\",",
|
||||
" \"build\": \"encore production --progress\"",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"webpack.config.js": {
|
||||
"contents": [
|
||||
"import Encore from '@symfony/webpack-encore';",
|
||||
"",
|
||||
"// Manually configure the runtime environment if not already configured yet by the \"encore\" command.",
|
||||
"// It's useful when you use tools that rely on webpack.config.js file.",
|
||||
"if (!Encore.isRuntimeEnvironmentConfigured()) {",
|
||||
" Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');",
|
||||
"}",
|
||||
"",
|
||||
"Encore",
|
||||
" // directory where compiled assets will be stored",
|
||||
" .setOutputPath('public/build/')",
|
||||
" // public path used by the web server to access the output path",
|
||||
" .setPublicPath('/build')",
|
||||
" // only needed for CDN's or subdirectory deploy",
|
||||
" //.setManifestKeyPrefix('build/')",
|
||||
"",
|
||||
" /*",
|
||||
" * ENTRY CONFIG",
|
||||
" *",
|
||||
" * Each entry will result in one JavaScript file (e.g. app.js)",
|
||||
" * and one CSS file (e.g. app.css) if your JavaScript imports CSS.",
|
||||
" */",
|
||||
" .addEntry('app', './assets/app.js')",
|
||||
"",
|
||||
" // When enabled, Webpack \"splits\" your files into smaller pieces for greater optimization.",
|
||||
" .splitEntryChunks()",
|
||||
"",
|
||||
" // will require an extra script tag for runtime.js",
|
||||
" // but, you probably want this, unless you're building a single-page app",
|
||||
" .enableSingleRuntimeChunk()",
|
||||
"",
|
||||
" /*",
|
||||
" * FEATURE CONFIG",
|
||||
" *",
|
||||
" * Enable & configure other features below. For a full",
|
||||
" * list of features, see:",
|
||||
" * https://symfony.com/doc/current/frontend.html#adding-more-features",
|
||||
" */",
|
||||
" .cleanupOutputBeforeBuild()",
|
||||
"",
|
||||
" // Displays build status system notifications to the user",
|
||||
" // .enableBuildNotifications()",
|
||||
"",
|
||||
" .enableSourceMaps(!Encore.isProduction())",
|
||||
" // enables hashed filenames (e.g. app.abc123.css)",
|
||||
" .enableVersioning(Encore.isProduction())",
|
||||
"",
|
||||
" // Configure JS and CSS minimizers",
|
||||
" // .configureJsMinimizerPlugin((options, MinimizerPlugin) => {",
|
||||
" // options.minify = MinimizerPlugin.esbuildMinify",
|
||||
" // })",
|
||||
" // .configureCssMinimizerPlugin((options, MinimizerPlugin) => {",
|
||||
" // options.minify = MinimizerPlugin.lightningCssMinify;",
|
||||
" // })",
|
||||
"",
|
||||
" // configure Babel",
|
||||
" .configureBabel((config) => {",
|
||||
" config.plugins.push(['polyfill-corejs3', { method: 'usage-global', version: '3.49' }]);",
|
||||
" })",
|
||||
"",
|
||||
" // enables Sass/SCSS support",
|
||||
" //.enableSassLoader()",
|
||||
"",
|
||||
" // uncomment if you use TypeScript",
|
||||
" //.enableTypeScriptLoader()",
|
||||
"",
|
||||
" // uncomment if you use React",
|
||||
" //.enableReactPreset()",
|
||||
"",
|
||||
" // uncomment to get integrity=\"...\" attributes on your script & link tags",
|
||||
" // requires WebpackEncoreBundle 1.4 or higher",
|
||||
" //.enableIntegrityHashes(Encore.isProduction())",
|
||||
"",
|
||||
" // uncomment if you're having problems with a jQuery plugin",
|
||||
" //.autoProvidejQuery()",
|
||||
";",
|
||||
"",
|
||||
"export default await Encore.getWebpackConfig();",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "3a870e92b23917ae95f0796a0599b1aca11d4bfd"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user