preprocess / pre-plugin Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi!
As I think I've seen, the .pre files are recompiled each time the classes are called by autoloader, even in production.
I think it should be interesting to make a cache system to avoid recompiling for nothing at each call, or (even better imo) a build system with a command line (webpack/babel like) to compile all the files.
What are your thoughts about that?
Thanks for you amazing work.
Hi,
I have a bug with the implementation of macros.
I have some docker containers for my servers, and when I do a composer dump, the macros are registered with the wrong path ('PRE_BASE_DIR' is constructed with my local path, and not the servers one).
I have to execute composer from inside my containers (and I do not have composer in theses containers.
A rapid solution could be to put a relative path in the pre.macros
file instead an absolute one.
Hi,
I'm creating a new plugin. Testing the case on pre-trailing-commas, I've executed the command `composer dump-autoload --optimize' and produced the error. In some way, the helpers file is being included twice:
This is the output:
...../pre-trailing-commas$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 30 installs, 0 updates, 0 removals
- Installing pre/plugin (0.11.3): Loading from cache
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/resource-operations (1.0.0): Loading from cache
- Installing sebastian/recursion-context (3.0.0): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Installing sebastian/object-enumerator (3.0.3): Loading from cache
- Installing sebastian/global-state (2.0.0): Loading from cache
- Installing sebastian/exporter (3.1.0): Loading from cache
- Installing sebastian/environment (3.1.0): Loading from cache
- Installing sebastian/diff (2.0.1): Loading from cache
- Installing sebastian/comparator (2.1.3): Loading from cache
- Installing doctrine/instantiator (1.1.0): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/phpunit-mock-objects (5.0.10): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing theseer/tokenizer (1.1.0): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
- Installing phpunit/php-token-stream (2.0.2): Loading from cache
- Installing phpunit/php-code-coverage (5.3.2): Loading from cache
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
- Installing webmozart/assert (1.4.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
- Installing phpspec/prophecy (1.8.0): Loading from cache
- Installing phar-io/version (1.0.1): Loading from cache
- Installing phar-io/manifest (1.0.1): Loading from cache
- Installing myclabs/deep-copy (1.8.1): Loading from cache
- Installing phpunit/phpunit (6.5.13): Loading from cache
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
Writing lock file
Generating autoload files
...../pre-trailing-commas$ composer dump-autoload --optimize
Generating optimized autoload files
PHP Fatal error: Cannot redeclare Pre\Plugin\find() (previously declared in /home/...../pre-trailing-commas/vendor/pre/plugin/source/functions.php:5) in /home/...../pre-trailing-commas/vendor/pre/plugin/source/functions.php on line 22
Fatal error: Cannot redeclare Pre\Plugin\find() (previously declared in /home/...../pre-trailing-commas/vendor/pre/plugin/source/functions.php:5) in /home/...../pre-trailing-commas/vendor/pre/plugin/source/functions.php on line 22
Did you take a look at the following project:
https://github.com/prolic/fpp
Is there a possibility for integration into preprocess.io?
The plugin assumes that <?php
is not present in the script itself. If <?php
is included in the file, at any point, the engine injects the macro.yay in the result.
You can verify the issue in this file, processing it with any plugin: https://github.com/symfony/translation/blob/master/Translator.php#L344
As a workaround, I've implemented in the caller a preprocessing of the text to escape <?php
before the call. But, I think it has to be fixed in the engine to support any PHP script.
Seems that marcioAlmada's Yay library has already updated the master branch to use its new macro syntax, so I think it's time to refactor macros from pre library too? I see you are already doing this for Optional Catch and Trailing Comma too.
I have up-to-date macros for the other pre libraries myself, though I cant get the short-closure one to work properly. Are you interested in receiving these files? I can send them to your email, it will save you some work, while you can make some corrections if I've made a mistake. What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.