How to set arguments on Symfony Assets - symfony

I use the jsqueeze assets filter for my project and digged in the code.
For me, it seems like the squeeze() function is beign called on the js files given.
Now i want to set the renaming variables argument on the squeeze function, but it is a third-party-bundle and i haven't found a solution to configure it in the config.yml where the filter is defined.

I found out where the magic happens.
All possible configurations are stored in the symfony assetics-bundle:
vendor>symfony>assetics-bundle>Resources>config>filters
For each filter, there is an xml file with the parameters you are able to change.
It took me a lot of time to find this, i think it is not documented in the symfony documentation.

Related

Prefix/Group Symfony Console Commands of an dependency

With symfony console commands you can prefix/group each one by putting in the setName("group:command"), and this is great.
myown
myown:cool
myown:foo
myown:bar
But the problem is that some external dependencies dont use this format. Ex: Phinx Migrations.
Since I'm importing an dependency that has a console command called migrate, I dont want for it to show without prefix/group. Not just because I might have another command called migrate or just for readability. I don't event know if we have 2 with same command name which one will show (need to check).
My question is: Is there any away for me to force a group commands from an external depencency to be inside an prefix/group?
You can achieve that, I wouldn't recommend but that would be the approach:
Create a compiler Pass which removes the definitions of the Commands you don't like
Register again all those commands while setting the names you like
If you need information on compiler passes:
https://symfony.com/doc/current/components/dependency_injection/compilation.html#components-di-compiler-pass
Maybe there's an easier way which I'm not aware, but for now that's my answer to you, I can't post all the code because that would be a lot of code and if you do it maybe you can update with the solution.
Good luck

How do I generate .d.ts typings from Flow code?

I have enabled Flow on a JavaScript project I am developing. Since I am putting in the effort to providing type annotations, I would really like to generate *.d.ts files so the broader TypeScript community can also have type information.
How can I generate *.d.ts type definition files from Flow-annotated JavaScript?
I searched for the available tools. I found the following.
The first one is the most up to date one. It can convert the whole Flow code to TypeScript. I have used it personally, and it works like a charm.
https://github.com/Khan/flow-to-ts
Other ones:
https://github.com/Kiikurage/babel-plugin-flow-to-typescript
https://github.com/burnnat/flow-to-dts
https://github.com/bcherny/flow-to-typescript
https://github.com/yuya-takeyama/flow2dts

Generate Empty class - Custom Console Command Creation Symfony

In Symfony I see various commands for generating empty classes,bundles, entities etc.
I searched to generate a empty class for the creation process of custom console commands. But I couldn't.
May I know whether any commands are available in Symfony to generate empty classes for creating custom console command ?
If not, May I know whether it was restricted for any reasons ?
Note: Currently Now, I copied the codes from the symfony.com and edited accordingly.
There is no such command but you can write one by yourself if you like. I would not use it myself i think because generating an empty class is not much work to do.

Frama-C: access to the cil/src/ext modules data and few others questions as well

first of all, i will explain what i would like to do here : given a C big programm, i would like to output a list of producers/consumers for a data and a list of calling/called-by functions of the function where this data is.
for doing this, i am thinking about using what computes some modules of frama-c, like dataflow.ml or callgraph.ml in my own plugin.
however, as i read the plugin developper doc, i can't manage to see how we can have access to the data of those modules.
is a "open.cyl_type" sufficient here in my own plugin?
moreover, here are my other questions :
i tried using by the way pdg plugin for my purposes but when i call it and it says "pdg graph computed", how can i access it?
is there any more documented thing about "impact" plugin than the official webpage, in depth, how it works fondamentally? (i have to say that i'm in like a pre-project phase, and that i installed frama-c with the apt-get on ubuntu and that i did not get an impact plugin working (i'll see by compiling the sources))
by the way, do you think i'm using the right method to get to my purposes?
Your question is quite unclear, and this answer is thus very generic. As mentioned in the developer documentation, there are two main classes of plugins: static plugins, compiled with the kernel and whose API is exposed in a module (usually of the same name of the plugin) in Db. Dynamic plugins, such as Semantic_callgraph register dynamically their entry points through the Dynamic module.
If you do make doc in Frama-C sources (I'm not sure that there is a corresponding package in Ubuntu) you can access documentation for the Db module in FRAMAC_SOURCE_DIR/doc/code/html/Db.html and the list of functions registered by dynamic plugins in FRAMAC_SOURCE_DIR/doc/code/dynamic_plugins/Dynamic_plugins.html.
I think that, following Virgile's advice, you should get the source code anyway because you will most of the time need to browse the code to find what you are looking for. Beside, you can have a look at the hello_word plug-in (in src/dummy/hello_world) to have an example of a very simple plug-in. You can also find some examples on my web site at https://anne.pacalet.fr/Notes/doku.php?id=notes:0061_frama_c_scripts to find out how to have access to some information in the AST.

Custom formula loader for assetic

I have searched high and low and could not find any example on how to write custom formula loader for assetic. Basically, I want to add a twig function (if possible, or do I have to use tag?) named add_asset. I need to somehow let assetic know that it must parse this function inside twig templates to gather assets to dump.
I have a hint that it has something to do with the AsseticTokenParser and TwigFormulaLoader but so far I have not figured that out yet. I have spent the whole weekend looking at this code and still have not figured out anything useful so far. Any direction is much appreciated.
This is a part of the quest to delay loading and processing assets till the very end of the response processing on Symfony 2.
I also posted a question on Dynamically adding assets via php which is also related to this question (but that one is for rendering assets, this one is for dumping assets)

Resources