From 9e09debab85b3087552068ab5d934a63dd30d097 Mon Sep 17 00:00:00 2001 From: Shin <2082119+shinsenter@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:07:34 +0900 Subject: [PATCH] Fixed Issue #68 (Got Warning Deprecated) (#70) --- .build/.beautify | 28 + {assets => .build}/.eslintrc | 13 +- .build/.minify | 29 + .build/.php-cs-fixer.php | 82 + .build/phpstan.neon | 15 + .build/rector.php | 64 + .docker/Dockerfile | 10 - .docker/blackfire.sh | 13 - .docker/docker-compose.yml | 15 - .gitignore | 10 +- .php-cs-fixer.php | 118 -- LICENSE | 2 +- README.md | 26 +- assets/.uglifyjs | 32 - assets/helpers.js | 100 +- composer.json | 37 +- composer.lock | 2204 ------------------------- defer.php | 12 +- docker-compose.yml | 11 + package-lock.json | 39 - package.json | 9 +- public/helpers.min.js | 2 +- public/lib/defer.min.js | 4 +- public/lib/defer_plus.min.js | 4 +- public/lib/polyfill.min.js | 2 +- sonar-project.properties | 7 - src/Bugs/BugAmpAttribute.php | 31 +- src/Bugs/BugCharset.php | 97 +- src/Bugs/BugHtml5DocType.php | 19 +- src/Bugs/BugLongLine.php | 21 +- src/Bugs/BugTemplateScripts.php | 37 +- src/Contracts/DeferLazyable.php | 14 +- src/Contracts/DeferMinifyable.php | 6 +- src/Contracts/DeferNormalizable.php | 7 +- src/Contracts/DeferOptimizable.php | 10 +- src/Contracts/DeferPreloadable.php | 22 +- src/Contracts/DeferReorderable.php | 7 +- src/Contracts/PatchInterface.php | 22 +- src/Defer.php | 181 +- src/Elements/CommentNode.php | 21 +- src/Elements/CommonDomTraits.php | 149 +- src/Elements/DocumentNode.php | 179 +- src/Elements/ElementNode.php | 27 +- src/Elements/NodeList.php | 52 +- src/Elements/TextNode.php | 23 +- src/Helpers/DeferAssetUtil.php | 54 +- src/Helpers/DeferCache.php | 125 +- src/Helpers/DeferConstant.php | 173 +- src/Helpers/DeferException.php | 6 +- src/Helpers/DeferJs.php | 235 ++- src/Helpers/DeferMinifier.php | 71 +- src/Helpers/DeferOptimizer.php | 60 +- src/Helpers/DeferOptions.php | 413 +++-- src/Resolvers/AnchorResolver.php | 19 +- src/Resolvers/DeferResolver.php | 190 ++- src/Resolvers/IframeResolver.php | 31 +- src/Resolvers/InlineStyleResolver.php | 40 +- src/Resolvers/LinkResolver.php | 186 ++- src/Resolvers/MediaResolver.php | 77 +- src/Resolvers/MetaResolver.php | 21 +- src/Resolvers/ScriptResolver.php | 205 ++- src/Resolvers/StyleResolver.php | 67 +- tests/helpers.php | 39 +- tests/v2/test.php | 33 +- 64 files changed, 2190 insertions(+), 3668 deletions(-) create mode 100644 .build/.beautify rename {assets => .build}/.eslintrc (96%) create mode 100644 .build/.minify create mode 100644 .build/.php-cs-fixer.php create mode 100644 .build/phpstan.neon create mode 100644 .build/rector.php delete mode 100644 .docker/Dockerfile delete mode 100644 .docker/blackfire.sh delete mode 100644 .docker/docker-compose.yml delete mode 100644 .php-cs-fixer.php delete mode 100644 assets/.uglifyjs delete mode 100644 composer.lock create mode 100644 docker-compose.yml delete mode 100644 package-lock.json delete mode 100644 sonar-project.properties diff --git a/.build/.beautify b/.build/.beautify new file mode 100644 index 0000000..dfb6cc0 --- /dev/null +++ b/.build/.beautify @@ -0,0 +1,28 @@ +{ + "brace_style": "collapse", + "break_chained_methods": true, + "comma_first": false, + "e4x": true, + "editorconfig": true, + "end_with_newline": true, + "eol": "\n", + "indent_char": " ", + "indent_inner_html": true, + "indent_level": 0, + "indent_scripts": "separate", + "indent_size": "2", + "indent_with_tabs": false, + "jslint_happy": true, + "keep_array_indentation": true, + "max_preserve_newlines": "2", + "operator_position": "before-newline", + "preserve_newlines": true, + "space_after_anon_function": true, + "space_after_named_function": true, + "space_before_conditional": true, + "space_in_empty_paren": true, + "space_in_paren": true, + "unescape_strings": true, + "unindent_chained_methods": false, + "wrap_line_length": "120" +} diff --git a/assets/.eslintrc b/.build/.eslintrc similarity index 96% rename from assets/.eslintrc rename to .build/.eslintrc index d703907..04f5243 100644 --- a/assets/.eslintrc +++ b/.build/.eslintrc @@ -58,8 +58,8 @@ "id-length": "off", "id-match": "error", "implicit-arrow-linebreak": "error", - "indent": "error", - "indent-legacy": "error", + "indent": ["error", 2], + "indent-legacy": "off", "init-declarations": "off", "jsx-quotes": "error", "key-spacing": "error", @@ -75,7 +75,7 @@ "max-depth": "error", "max-len": "off", "max-lines": "off", - "max-lines-per-function": "error", + "max-lines-per-function": ["error", 100], "max-nested-callbacks": "error", "max-params": "off", "max-statements": "off", @@ -169,7 +169,12 @@ "no-unmodified-loop-condition": "error", "no-unneeded-ternary": "error", "no-unused-expressions": "off", - "no-use-before-define": "error", + "no-use-before-define": ["error", { + "allowNamedExports": false, + "classes": true, + "functions": false, + "variables": true + }], "no-useless-call": "error", "no-useless-catch": "error", "no-useless-computed-key": "error", diff --git a/.build/.minify b/.build/.minify new file mode 100644 index 0000000..d753681 --- /dev/null +++ b/.build/.minify @@ -0,0 +1,29 @@ +{ + "parse": {}, + "mangle": { + "reserved": ["log", "debug", "perf_begin", "perf_end"] + }, + "compress": { + "drop_console": true, + "hoist_funs": true, + "passes": 10, + "pure_getters": true, + "pure_funcs": ["log", "debug", "perf_begin", "perf_end"], + "reduce_funcs": true + }, + "output": { + "comments": "/^!/", + "wrap_iife": true + }, + "annotations": false, + "ie": true, + "keep_fargs": false, + "keep_fnames": false, + "module": false, + "nameCache": null, + "sourceMap": false, + "toplevel": false, + "v8": true, + "warnings": false, + "webkit": true +} \ No newline at end of file diff --git a/.build/.php-cs-fixer.php b/.build/.php-cs-fixer.php new file mode 100644 index 0000000..cbe9db5 --- /dev/null +++ b/.build/.php-cs-fixer.php @@ -0,0 +1,82 @@ +=5.6 + * + * @category Web_Performance_Optimization + * @package AppSeeds + * @author Mai Nhut Tan + * @copyright 2019-2023 SHIN Company + * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT + * @link https://code.shin.company/defer.php + * @see https://code.shin.company/defer.php/blob/master/README.md + */ + +define('WEBHOME', '/var/www/html'); + +$header = <<<'EOF' +Defer.php aims to help you concentrate on web performance optimization. +(c) 2019-2023 SHIN Company https://shin.company + +PHP Version >=5.6 + +@category Web_Performance_Optimization +@package AppSeeds +@author Mai Nhut Tan +@copyright 2019-2023 SHIN Company +@license https://code.shin.company/defer.php/blob/master/LICENSE MIT +@link https://code.shin.company/defer.php +@see https://code.shin.company/defer.php/blob/master/README.md +EOF; + +$rules = [ + '@PhpCsFixer' => true, + 'concat_space' => ['spacing' => 'one'], + 'empty_loop_body' => ['style' => 'braces'], + 'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'], + 'increment_style' => ['style' => 'post'], + 'no_superfluous_phpdoc_tags' => false, + 'phpdoc_summary' => true, + 'phpdoc_to_comment' => false, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'self_static_accessor' => false, + 'yoda_style' => false, + + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + + 'phpdoc_align' => ['align' => 'vertical'], + + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => [ + '||' => 'align_single_space_minimal', + 'or' => 'align_single_space_minimal', + '=' => 'align_single_space_minimal', + '=>' => 'align_single_space_minimal', + '<=>' => 'align_single_space_minimal', + ], + ], + + 'visibility_required' => [ + 'elements' => ['method', 'property'], + ], +]; + +$finder = \PhpCsFixer\Finder::create() + ->in(dirname(__DIR__)) + ->name('*.php') + ->exclude('_old') + ->exclude('cache') + ->ignoreDotFiles(false) + ->ignoreVCS(true); + +return (new \PhpCsFixer\Config()) + ->setFinder($finder) + ->setRules($rules) + ->setLineEnding("\n") + ->setUsingCache(false); diff --git a/.build/phpstan.neon b/.build/phpstan.neon new file mode 100644 index 0000000..1cab37b --- /dev/null +++ b/.build/phpstan.neon @@ -0,0 +1,15 @@ +parameters: + level: 8 + phpVersion: 70100 + fileExtensions: + - php + paths: + - /var/www/html/ + excludePaths: + - /var/www/html/_*/* + - /var/www/html/mode_modules/* + - /var/www/html/vendor/* + ignoreErrors: + - '#has no return type specified#' + checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false diff --git a/.build/rector.php b/.build/rector.php new file mode 100644 index 0000000..fbf6e41 --- /dev/null +++ b/.build/rector.php @@ -0,0 +1,64 @@ +=5.6 + * + * @category Web_Performance_Optimization + * @package AppSeeds + * @author Mai Nhut Tan + * @copyright 2019-2023 SHIN Company + * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT + * @link https://code.shin.company/defer.php + * @see https://code.shin.company/defer.php/blob/master/README.md + */ + +use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector; +use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; +use Rector\Config\RectorConfig; +use Rector\Set\ValueObject\DowngradeLevelSetList; +use Rector\Set\ValueObject\LevelSetList; +use Rector\Set\ValueObject\SetList; + +return static function (RectorConfig $rectorConfig): void { + $rectorConfig->disableParallel(); + $rectorConfig->importNames(); + $rectorConfig->indent(' ', 4); + $rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon'); + + // scan paths + $rectorConfig->paths([ + '/var/www/html/', + ]); + + // skip paths and rules + $rectorConfig->skip([ + '/var/www/html/_*/', + '/var/www/html/cache/', + '/var/www/html/node_modules/', + '/var/www/html/vendor/', + ]); + + // rule sets + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_82, + SetList::DEAD_CODE, + SetList::EARLY_RETURN, + SetList::CODE_QUALITY, + SetList::CODING_STYLE, + DowngradeLevelSetList::DOWN_TO_PHP_55, + ]); + + $rectorConfig->rules([ + NewlineAfterStatementRector::class, + ]); + + // extra rules + $rectorConfig->ruleWithConfiguration(ConsistentPregDelimiterRector::class, [ + ConsistentPregDelimiterRector::DELIMITER => '/', + ]); +}; diff --git a/.docker/Dockerfile b/.docker/Dockerfile deleted file mode 100644 index 2d8efdc..0000000 --- a/.docker/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# Dockerfile -FROM php:7-zts - -# Install Composer, NPM -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - ;apt update -y \ - ;apt install -y nodejs npm git zip unzip \ - ;npm i -g npm - -CMD ["/usr/local/bin/composer", "docker"] diff --git a/.docker/blackfire.sh b/.docker/blackfire.sh deleted file mode 100644 index 3db2e45..0000000 --- a/.docker/blackfire.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -mkdir -p /tmp/blackfire -architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) -curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux/$architecture | tar zxp -C /tmp/blackfire -mv /tmp/blackfire/blackfire /usr/bin/blackfire -rm -Rf /tmp/blackfire - -apt install -y wget gnupg2 -wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add - -echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list -apt update -y -apt install -y blackfire-php diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml deleted file mode 100644 index 2859f8d..0000000 --- a/.docker/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: '3' - -services: - test: - tty: true - privileged: true - build: . - image: defer-php-test - container_name: defer-php - hostname: defer-php-test - volumes: - - ..:/home/defer-php - environment: - - APP_ENV=local - working_dir: /home/defer-php diff --git a/.gitignore b/.gitignore index 03c2b63..afd77bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ -.php_cs.cache -composer.phar +_* +.DS_Store +*.cache +/cache/ /node_modules/ /vendor/ -/cache/ -/.scannerwork \ No newline at end of file +composer.lock +package-lock.json \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php deleted file mode 100644 index b356cf7..0000000 --- a/.php-cs-fixer.php +++ /dev/null @@ -1,118 +0,0 @@ -=5.6 - * - * @category Web_Performance_Optimization - * @package AppSeeds - * @author Mai Nhut Tan - * @copyright 2021 AppSeeds - * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT - * @link https://code.shin.company/defer.php - * @see https://code.shin.company/defer.php/blob/master/README.md - */ - -$header = <<<'EOF' -Defer.php aims to help you concentrate on web performance optimization. -(c) 2021 AppSeeds https://appseeds.net/ - -PHP Version >=5.6 - -@category Web_Performance_Optimization -@package AppSeeds -@author Mai Nhut Tan -@copyright 2021 AppSeeds -@license https://code.shin.company/defer.php/blob/master/LICENSE MIT -@link https://code.shin.company/defer.php -@see https://code.shin.company/defer.php/blob/master/README.md -EOF; - -$rules = [ - '@Symfony' => true, - '@PSR2' => true, - 'align_multiline_comment' => true, - 'array_indentation' => true, - 'array_syntax' => ['syntax' => 'short'], - 'braces' => ['allow_single_line_closure' => true], - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'escape_implicit_backslashes' => true, - 'explicit_indirect_variable' => true, - 'explicit_string_variable' => true, - 'fully_qualified_strict_types' => true, - 'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'], - 'heredoc_to_nowdoc' => true, - 'increment_style' => ['style' => 'post'], - 'list_syntax' => ['syntax' => 'long'], - 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], - 'method_chaining_indentation' => true, - 'multiline_comment_opening_closing' => true, - 'native_function_invocation' => false, - 'no_alternative_syntax' => true, - 'no_blank_lines_before_namespace' => false, - 'no_binary_string' => true, - 'no_empty_phpdoc' => true, - 'no_null_property_initialization' => true, - 'no_superfluous_elseif' => true, - 'no_unneeded_curly_braces' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_class_elements' => true, - 'ordered_imports' => true, - 'php_unit_internal_class' => true, - 'php_unit_test_class_requires_covers' => true, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_order' => true, - 'phpdoc_separation' => false, - 'phpdoc_summary' => false, - 'phpdoc_types_order' => true, - 'return_assignment' => false, - 'semicolon_after_instruction' => true, - 'single_line_comment_style' => false, - 'single_quote' => true, - 'yoda_style' => false, - 'blank_line_before_statement' => [ - 'statements' => [ - 'continue', 'declare', 'return', 'throw', 'try', - 'declare', 'for', 'foreach', 'goto', 'if', - ], - ], - 'no_extra_blank_lines' => [ - 'tokens' => [ - 'continue', 'extra', 'return', 'throw', 'use', - 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block', - ], - ], - 'binary_operator_spaces' => [ - 'default' => 'single_space', - 'operators' => [ - '=' => 'align_single_space_minimal', - '=>' => 'align_single_space_minimal', - ], - ], -]; - -$finder = \PhpCsFixer\Finder::create() - ->in(__DIR__ . DIRECTORY_SEPARATOR) - ->name('*.php') - ->exclude('.docker') - ->exclude('.ppm') - ->exclude('assets') - ->exclude('cache') - ->exclude('patches') - ->exclude('public') - ->exclude('tests/v1') - ->exclude('v1') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new \PhpCsFixer\Config()) - ->setFinder($finder) - ->setRules($rules) - ->setLineEnding("\n") - ->setUsingCache(false); diff --git a/LICENSE b/LICENSE index 50c2936..5b5848f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 AppSeeds +Copyright (c) 2019-2023 SHIN Company Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3b9ed5b..f24c4f9 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,20 @@ 🚀 A PHP library that aims to help you concentrate on web performance optimization. - **Package**: [@shinsenter/defer.php](https://packagist.org/packages/shinsenter/defer.php) -- **Version**: 2.4.0 +- **Version**: 2.5.0 - **Author**: Mai Nhut Tan -- **Copyright**: 2021 AppSeeds +- **Copyright**: 2019-2023 SHIN Company - **License**: [MIT](https://raw.githubusercontent.com/shinsenter/defer.php/master/LICENSE) -[![GitHub](https://img.shields.io/github/license/shinsenter/defer.php.svg)](https://github.com/shinsenter/defer.php) -[![GitHub Release Date](https://img.shields.io/github/release-date/shinsenter/defer.php.svg)](https://github.com/shinsenter/defer.php/releases) +[![GitHub](https://img.shields.io/github/license/shinsenter/defer.php.svg)](https://code.shin.company/defer.php) +[![GitHub Release Date](https://img.shields.io/github/release-date/shinsenter/defer.php.svg)](https://code.shin.company/defer.php/releases) [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/shinsenter/defer.php)](https://www.codefactor.io/repository/github/shinsenter/defer.php) -[![Post an issue](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/shinsenter/defer.php/issues) -[![GitHub issues](https://img.shields.io/github/issues-raw/shinsenter/defer.php.svg)](https://github.com/shinsenter/defer.php/issues/new) +[![Post an issue](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://code.shin.company/defer.php/issues) +[![GitHub issues](https://img.shields.io/github/issues-raw/shinsenter/defer.php.svg)](https://code.shin.company/defer.php/issues/new) * * * -🥇 Powered by [defer.js](https://github.com/shinsenter/defer.js) - A super small, super efficient library that helps you lazy load almost everything like images, video, audio, iframes as well as stylesheets, and JavaScript. +🥇 Powered by [defer.js](https://code.shin.company/defer.js) - A super small, super efficient library that helps you lazy load almost everything like images, video, audio, iframes as well as stylesheets, and JavaScript. * * * @@ -125,7 +125,7 @@ $options = [ 'manually_add_deferjs' => false, // URL to defer.js javascript file. - // Default: https://cdn.jsdelivr.net/npm/@shinsenter/defer.js@2.5.0/dist/defer_plus.min.js + // Default: https://cdn.jsdelivr.net/npm/@shinsenter/defer.js@3.6.0/dist/defer_plus.min.js 'deferjs_src' => \AppSeeds\DeferConstant::SRC_DEFERJS_CDN, // URL to javascript contains fixes. @@ -369,21 +369,21 @@ Only few options of this library are applicable to AMP pages (minifying HTML con ### Defer.js -[https://github.com/shinsenter/defer.js/](https://github.com/shinsenter/defer.js/) +[https://code.shin.company/defer.js/](https://code.shin.company/defer.js/) 🥇 A super small, super efficient library that helps you lazy load almost everything like images, video, audio, iframes as well as stylesheets, and JavaScript. ### Wordpress plugin -[https://github.com/shinsenter/defer-wordpress/](https://github.com/shinsenter/defer-wordpress/) +[https://code.shin.company/defer-wordpress/](https://code.shin.company/defer-wordpress/) ⚡️ A native, blazing fast lazy loader. ✅ Legacy browsers support (IE9+). 💯 SEO friendly. 🧩 Lazy-load everything. ### Laravel package -[https://github.com/shinsenter/defer-laravel/](https://github.com/shinsenter/defer-laravel/) +[https://code.shin.company/defer-laravel/](https://code.shin.company/defer-laravel/) 🚀 A Laravel package that focuses on minimizing payload size of HTML document and optimizing processing on the browser when rendering the web page. @@ -392,8 +392,8 @@ Only few options of this library are applicable to AMP pages (minifying HTML con [![Donate via Paypal](https://img.shields.io/badge/Donate-Paypal-blue)](https://www.paypal.me/shinsenter) [![Become a sponsor](https://img.shields.io/badge/Donate-Patreon-orange)](https://www.patreon.com/appseeds) -[![Become a stargazer](https://img.shields.io/badge/Support-Stargazer-yellow)](https://github.com/shinsenter/defer.php/stargazers) -[![Report an issue](https://img.shields.io/badge/Support-Issues-red)](https://github.com/shinsenter/defer.php/issues/new) +[![Become a stargazer](https://img.shields.io/badge/Support-Stargazer-yellow)](https://code.shin.company/defer.php/stargazers) +[![Report an issue](https://img.shields.io/badge/Support-Issues-red)](https://code.shin.company/defer.php/issues/new) * * * diff --git a/assets/.uglifyjs b/assets/.uglifyjs deleted file mode 100644 index c5d82de..0000000 --- a/assets/.uglifyjs +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compress": {}, - "mangle": { - "eval": false, - "keep_fnames": false, - "reserved": [], - "toplevel": false - }, - "nameCache": {}, - "output": { - "ascii_only": true, - "beautify": false, - "braces": false, - "indent_level": 0, - "indent_start": 0, - "inline_script": true, - "keep_quoted_props": false, - "max_line_len": false, - "preamble": null, - "preserve_line": false, - "quote_keys": false, - "quote_style": 1, - "semicolons": true, - "shebang": true, - "source_map": null, - "width": 80, - "wrap_iife": false, - "comments": "/^@/", - "webkit": true - }, - "wrap": null -} diff --git a/assets/helpers.js b/assets/helpers.js index 7f7b996..7c7399e 100644 --- a/assets/helpers.js +++ b/assets/helpers.js @@ -1,6 +1,6 @@ /** * Package shinsenter/defer.php - * https://github.com/shinsenter/defer.php + * https://code.shin.company/defer.php * * Released under the MIT license * https://raw.githubusercontent.com/shinsenter/defer.php/master/LICENSE @@ -31,91 +31,91 @@ (function (window, document, console) { - /* + /* |-------------------------------------------------------------------------- | Define variables and constants |-------------------------------------------------------------------------- */ - // Common texts - var _dataLayer = 'dataLayer'; + // Common texts + var _dataLayer = 'dataLayer'; - // Common CSS selectors - var _queryTarget = '.defer-loading:not([data-ignore])'; + // Common CSS selectors + var _queryTarget = '.defer-loading:not([data-ignore])'; - /* + /* |-------------------------------------------------------------------------- | Check for defer.js |-------------------------------------------------------------------------- */ - var defer = window.Defer; - var _delay = window.DEFERJS_DELAY || 8; - var _options = window.DEFERJS_OPTIONS || {'rootMargin': '150%'}; + var defer = window.Defer; + var _delay = window.DEFERJS_DELAY || 8; + var _options = window.DEFERJS_OPTIONS || {'rootMargin': '150%'}; - /* + /* |-------------------------------------------------------------------------- | Internal functions |-------------------------------------------------------------------------- */ - function _replaceClass(node, find, replace) { - node.className = ((' ' + node.className + ' '). - replace(' ' + find + ' ', ' ') + replace).trim(); - } + function _replaceClass(node, find, replace) { + node.className = ((' ' + node.className + ' '). + replace(' ' + find + ' ', ' ') + replace).trim(); + } - /* + /* |-------------------------------------------------------------------------- | Fallback for external libraries |-------------------------------------------------------------------------- */ - // Fix missing dataLayer (for Google Analytics) - // See: https://developers.google.com/analytics/devguides/collection/analyticsjs - window.ga = window.ga || function () {(window.ga.q = window.ga.q || []).push(arguments)}; window.ga.l = Number(Date()); - window[_dataLayer] = window[_dataLayer] || []; + // Fix missing dataLayer (for Google Analytics) + // See: https://developers.google.com/analytics/devguides/collection/analyticsjs + window.ga = window.ga || function () {(window.ga.q = window.ga.q || []).push(arguments)}; window.ga.l = Number(Date()); + window[_dataLayer] = window[_dataLayer] || []; - /* + /* |-------------------------------------------------------------------------- | Define helper object |-------------------------------------------------------------------------- */ - _replaceClass( - document.documentElement, - 'no-deferjs', - defer ? 'deferjs' : '' - ); + _replaceClass( + document.documentElement, + 'no-deferjs', + defer ? 'deferjs' : '' + ); - // Check if missing defer feature - if (!defer) { - return; - } + // Check if missing defer feature + if (!defer) { + return; + } - /* + /* |-------------------------------------------------------------------------- | Main |-------------------------------------------------------------------------- */ - // Lazyload all style tags - defer(function() { - [].slice.call(document.querySelectorAll('style[defer]')). - forEach(defer.reveal); - }, _delay); - - // Lazyload all media - defer.dom(_queryTarget, _delay, 0, function (node) { - _replaceClass(node, 'defer-loading', 'defer-loaded'); - }, _options); - - // Copyright - if (console.log) { - console.log([ - 'Optimized by defer.php', - '(c) 2021 AppSeeds', - 'Github: https://code.shin.company/defer.php' - ].join('\n')); - } + // Lazyload all style tags + defer(function() { + [].slice.call(document.querySelectorAll('style[defer]')). + forEach(defer.reveal); + }, _delay); + + // Lazyload all media + defer.dom(_queryTarget, _delay, 0, function (node) { + _replaceClass(node, 'defer-loading', 'defer-loaded'); + }, _options); + + // Copyright + if (console.log) { + console.log([ + 'Optimized by defer.php', + '(c) 2019-2023 SHIN Company', + 'Github: https://code.shin.company/defer.php' + ].join('\n')); + } })(this, document, console); diff --git a/composer.json b/composer.json index b84b4b7..1de5a1b 100644 --- a/composer.json +++ b/composer.json @@ -59,26 +59,10 @@ } }, "scripts": { - "fixer": "php-cs-fixer fix --show-progress=dots --verbose --ansi", - "test": "@php tests/v2/test.php --ansi", - "bf": "blackfire run php tests/v2/test.php --ansi", - "assets": [ - "npm run lint --ansi", - "npm run js --ansi", - "npm run css --ansi", - "npm run copy --ansi" - ], - "pull": [ - "rm -rf ./cache/*/ ./vendor/ ./composer.lock", - "composer update -o -a -n --prefer-dist --ansi", - "npm run pull --ansi", - "@assets" - ], - "docker": [ - "@pull", - "@fixer", - "@test" - ] + "fixer": "php-cs-fixer fix --config=.build/.php-cs-fixer.php --show-progress=dots --verbose --ansi", + "rector": "rector --config .build/rector.php --verbose --ansi", + "phpstan": "phpstan analyse -c .build/phpstan.neon --verbose --ansi", + "test": "@php tests/v2/test.php --ansi" }, "require": { "php": "^5.6 || ^7.0 || ^8.0", @@ -86,12 +70,14 @@ "lib-libxml": ">=2.7.7", "mrclay/jsmin-php": "^2.0", "psr/simple-cache": "^1.0", - "symfony/css-selector": "^2.0 || ^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^2.0 || ^3.0 || ^4.0 || ^5.0", + "symfony/css-selector": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0", + "symfony/options-resolver": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0", "symfony/polyfill-mbstring": "^1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": ">=2" + "friendsofphp/php-cs-fixer": "*", + "phpstan/phpstan": "*", + "rector/rector": "*" }, "suggest": { "ext-mbstring": "*" @@ -100,12 +86,9 @@ "prefer-stable": true, "config": { "preferred-install": "dist", - "optimize-autoloader": true, "sort-packages": true }, "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } + "branch-alias": {} } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index ad97f4c..0000000 --- a/composer.lock +++ /dev/null @@ -1,2204 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "09448ce3eaea81dcf3754a1bdd7b37d6", - "packages": [ - { - "name": "mrclay/jsmin-php", - "version": "2.4.0", - "source": { - "type": "git", - "url": "https://github.com/mrclay/jsmin-php.git", - "reference": "bb05febc9440852d39899255afd5569b7f21a72c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mrclay/jsmin-php/zipball/bb05febc9440852d39899255afd5569b7f21a72c", - "reference": "bb05febc9440852d39899255afd5569b7f21a72c", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "JSMin\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stephen Clay", - "email": "steve@mrclay.org", - "role": "Developer" - }, - { - "name": "Ryan Grove", - "email": "ryan@wonko.com", - "role": "Developer" - } - ], - "description": "Provides a modified port of Douglas Crockford's jsmin.c, which removes unnecessary whitespace from JavaScript files.", - "homepage": "https://github.com/mrclay/jsmin-php/", - "keywords": [ - "compress", - "jsmin", - "minify" - ], - "support": { - "email": "minify@googlegroups.com", - "issues": "https://github.com/mrclay/jsmin-php/issues", - "source": "https://github.com/mrclay/jsmin-php/tree/master" - }, - "time": "2018-12-06T15:03:38+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" - }, - "time": "2017-10-23T01:57:42+00:00" - }, - { - "name": "symfony/css-selector", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "7fb120adc7f600a59027775b224c13a33530dd90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/7fb120adc7f600a59027775b224c13a33530dd90", - "reference": "7fb120adc7f600a59027775b224c13a33530dd90", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Converts CSS selectors to XPath expressions", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-21T12:38:00+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "a603e5701bd6e305cfc777a8b50bf081ef73105e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a603e5701bd6e305cfc777a8b50bf081ef73105e", - "reference": "a603e5701bd6e305cfc777a8b50bf081ef73105e", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an improved replacement for the array_replace PHP function", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-23T15:55:36+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T12:26:48+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-28T13:41:28+00:00" - } - ], - "packages-dev": [ - { - "name": "composer/semver", - "version": "3.2.5", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.54", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.5" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-05-24T12:41:47+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-07-31T17:03:58+00:00" - }, - { - "name": "doctrine/annotations", - "version": "1.13.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.2" - }, - "time": "2021-08-05T19:00:23+00:00" - }, - { - "name": "doctrine/lexer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" - } - ], - "time": "2020-05-25T17:44:05+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v3.0.2", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/990b979379502feb7f393d6c9aa36cc9b9765f24", - "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24", - "shasum": "" - }, - "require": { - "composer/semver": "^3.2", - "composer/xdebug-handler": "^2.0", - "doctrine/annotations": "^1.12", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^7.1.3 || ^8.0", - "php-cs-fixer/diff": "^2.0", - "symfony/console": "^4.4.20 || ^5.1.3", - "symfony/event-dispatcher": "^4.4.20 || ^5.0", - "symfony/filesystem": "^4.4.20 || ^5.0", - "symfony/finder": "^4.4.20 || ^5.0", - "symfony/options-resolver": "^4.4.20 || ^5.0", - "symfony/polyfill-php72": "^1.22", - "symfony/process": "^4.4.20 || ^5.0", - "symfony/stopwatch": "^4.4.20 || ^5.0" - }, - "require-dev": { - "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^1.4", - "mikey179/vfsstream": "^1.6.8", - "php-coveralls/php-coveralls": "^2.4.3", - "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy": "^1.10.3", - "phpspec/prophecy-phpunit": "^1.1 || ^2.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5", - "phpunitgoodpractices/polyfill": "^1.5", - "phpunitgoodpractices/traits": "^1.9.1", - "symfony/phpunit-bridge": "^5.2.4", - "symfony/yaml": "^4.4.20 || ^5.0" - }, - "suggest": { - "ext-dom": "For handling output formats in XML", - "ext-mbstring": "For handling non-UTF8 characters.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "support": { - "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.0.2" - }, - "funding": [ - { - "url": "https://github.com/keradus", - "type": "github" - } - ], - "time": "2021-08-04T19:28:19+00:00" - }, - { - "name": "php-cs-fixer/diff", - "version": "v2.0.2", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "sebastian/diff v3 backport support for PHP 5.6+", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "support": { - "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" - }, - "time": "2020-10-14T08:32:19+00:00" - }, - { - "name": "psr/cache", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" - }, - "time": "2021-02-03T23:26:27+00:00" - }, - { - "name": "psr/container", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" - }, - "time": "2021-03-05T17:36:06+00:00" - }, - { - "name": "psr/event-dispatcher", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Standard interfaces for event handling.", - "keywords": [ - "events", - "psr", - "psr-14" - ], - "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" - }, - "time": "2019-01-08T18:20:26+00:00" - }, - { - "name": "psr/log", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/2.0.0" - }, - "time": "2021-07-14T16:41:46+00:00" - }, - { - "name": "symfony/console", - "version": "v5.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/51b71afd6d2dc8f5063199357b9880cea8d8bfe2", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v5.3.6" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-27T19:10:22+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f2fd2208157553874560f3645d4594303058c4bd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f2fd2208157553874560f3645d4594303058c4bd", - "reference": "f2fd2208157553874560f3645d4594303058c4bd", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/dependency-injection": "<4.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-23T15:55:36+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/event-dispatcher": "^1" - }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-21T12:40:44+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "17f50e06018baec41551a71a15731287dbaab186" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17f50e06018baec41551a71a15731287dbaab186", - "reference": "17f50e06018baec41551a71a15731287dbaab186", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-23T15:54:19+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T12:26:48+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T09:17:38+00:00" - }, - { - "name": "symfony/process", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d16634ee55b895bd85ec714dadc58e4428ecf030", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-23T15:54:19+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-04-01T10:43:52+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "b24c6a92c6db316fee69e38c80591e080e41536c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b24c6a92c6db316fee69e38c80591e080e41536c", - "reference": "b24c6a92c6db316fee69e38c80591e080e41536c", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/service-contracts": "^1.0|^2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a way to profile code", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-10T08:58:57+00:00" - }, - { - "name": "symfony/string", - "version": "v5.3.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" - }, - "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "files": [ - "Resources/functions.php" - ], - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v5.3.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-06-27T11:44:38+00:00" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": true, - "prefer-lowest": false, - "platform": { - "php": "^5.6 || ^7.0 || ^8.0", - "ext-libxml": "*", - "lib-libxml": ">=2.7.7" - }, - "platform-dev": [], - "plugin-api-version": "2.1.0" -} diff --git a/defer.php b/defer.php index 519b4ae..75aa137 100644 --- a/defer.php +++ b/defer.php @@ -2,24 +2,26 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md */ +use AppSeeds\Defer; + if (!defined('DEFER_PHP_ROOT')) { - define('DEFER_PHP_ROOT', dirname(__FILE__)); + define('DEFER_PHP_ROOT', __DIR__); } -if (!class_exists('AppSeeds\Defer')) { +if (!class_exists(Defer::class)) { $baseDir = DEFER_PHP_ROOT; $localV = DEFER_PHP_ROOT . '/vendor/autoload.php'; $globalV = dirname(dirname($baseDir)) . '/autoload.php'; @@ -29,6 +31,6 @@ } elseif (file_exists($globalV)) { require_once $globalV; } else { - throw new \Exception(PHP_EOL . 'Please run: php composer install' . PHP_EOL); + throw new Exception(PHP_EOL . 'Please run: php composer install' . PHP_EOL); } } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a467782 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' + +services: + deferphp: + image: ${BASE_IMAGE:-shinsenter/php}:${PHP_VERSION:-8.2} + container_name: deferphp + hostname: deferphp + volumes: + - .:/var/www/html + working_dir: /var/www/html + entrypoint: "tail -f /dev/stdout" diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 06efbc3..0000000 --- a/package-lock.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "defer.php", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "license": "MIT", - "dependencies": { - "@shinsenter/defer.js": "^2.5.0" - } - }, - "node_modules/@shinsenter/defer.js": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@shinsenter/defer.js/-/defer.js-2.5.0.tgz", - "integrity": "sha512-XWMKIZQFW7nfI8sPQR2kWsMezKfrIngREIGpnd3COka33ANNBjdlkdViqpcia6/R+9T0idnCuP3MZS8OYZrEMw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/shinsenter/defer.js/stargazers" - }, - { - "type": "paypal", - "url": "https://www.patreon.com/appseeds" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/shinsenter" - } - ] - } - }, - "dependencies": { - "@shinsenter/defer.js": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@shinsenter/defer.js/-/defer.js-2.5.0.tgz", - "integrity": "sha512-XWMKIZQFW7nfI8sPQR2kWsMezKfrIngREIGpnd3COka33ANNBjdlkdViqpcia6/R+9T0idnCuP3MZS8OYZrEMw==" - } - } -} diff --git a/package.json b/package.json index 4644a0b..0797fa5 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { - "homepage": "https://github.com/shinsenter/defer.php#readme", + "homepage": "https://code.shin.company/defer.php#readme", "author": "Mai Nhut Tan ", "license": "MIT", "dependencies": { - "@shinsenter/defer.js": "^2.5.0" + "@shinsenter/defer.js": "^3.6" }, "scripts": { "cleanup": "rm -rf ./node_modules package-lock.json", "tools": "npm -g i eslint js-beautify uglify-js clean-css-cli", "pull": "npm run cleanup && npm run tools && npm i --prod && npm audit fix", + "build": "npm run copy && npm run lint && npm run js && npm audit css", "copy": "cp -p ./node_modules/@shinsenter/defer.js/dist/*.js ./public/lib/", - "lint": "eslint --config assets/.eslintrc --ext .js assets --fix", - "js": "uglifyjs --config-file assets/.uglifyjs -o public/helpers.min.js assets/helpers.js", + "lint": "eslint --config .build/.eslintrc --ext .js assets --fix", + "js": "uglifyjs --config-file .build/.minify -o public/helpers.min.js assets/helpers.js", "css": "cleancss -o public/styles.min.css assets/styles.css" } } diff --git a/public/helpers.min.js b/public/helpers.min.js index 4cdd60d..6d83bf1 100644 --- a/public/helpers.min.js +++ b/public/helpers.min.js @@ -1 +1 @@ -!function(e,a,o){var n='dataLayer',r=e.Defer,t=e.DEFERJS_DELAY||8,d=e.DEFERJS_OPTIONS||{rootMargin:'150%'};function l(e,a,o){e.className=((' '+e.className+' ').replace(' '+a+' ',' ')+o).trim()}e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=Number(Date()),e[n]=e[n]||[],l(a.documentElement,'no-deferjs',r?'deferjs':''),r&&(r(function(){[].slice.call(a.querySelectorAll('style[defer]')).forEach(r.reveal)},t),r.dom('.defer-loading:not([data-ignore])',t,0,function(e){l(e,'defer-loading','defer-loaded')},d),o.log&&o.log(['Optimized by defer.php','(c) 2021 AppSeeds','Github: https://code.shin.company/defer.php'].join('\n')))}(this,document,console); \ No newline at end of file +!(function(e,a,o){function n(e,a,o){e.className=((" "+e.className+" ").replace(" "+a+" "," ")+o).trim()}var r="dataLayer",t=e.Defer,d=e.DEFERJS_DELAY||8,l=e.DEFERJS_OPTIONS||{rootMargin:"150%"};e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=Number(Date()),e[r]=e[r]||[],n(a.documentElement,"no-deferjs",t?"deferjs":""),t&&(t(function(){[].slice.call(a.querySelectorAll("style[defer]")).forEach(t.reveal)},d),t.dom(".defer-loading:not([data-ignore])",d,0,function(e){n(e,"defer-loading","defer-loaded")},l),o.log)&&o.log(["Optimized by defer.php","(c) 2019-2023 SHIN Company","Github: https://code.shin.company/defer.php"].join("\n"))})(this,document,console); \ No newline at end of file diff --git a/public/lib/defer.min.js b/public/lib/defer.min.js index e6ba898..1bcc9a0 100644 --- a/public/lib/defer.min.js +++ b/public/lib/defer.min.js @@ -1,2 +1,2 @@ -/*@shinsenter/defer.js@2.5.0*/ -!function(r,i,t){var u,o=/^data-(.+)/,a='IntersectionObserver',c=/p/.test(i.readyState),s=[],f=s.slice,l='deferjs',n='load',e='pageshow',d='forEach',h='shift';function m(e){i.head.appendChild(e)}function v(e,n){f.call(e.attributes)[d](n)}function p(e,n,t,o){return o=(o=n?i.getElementById(n):o)||i.createElement(e),n&&(o.id=n),t&&(o.onload=t),o}function y(e,n){return f.call((n||i).querySelectorAll(e))}function b(t,e){y('source',t)[d](b),v(t,function(e,n){(n=o.exec(e.name))&&(t[n[1]]=e.value)}),e&&(t.className+=' '+e),n in t&&t[n]()}function I(e){u(function(o){o=y(e||'[type=deferjs]'),function e(n,t){(n=o[h]())&&(n.parentNode.removeChild(n),(t=p(n.nodeName)).text=n.text,v(n,function(e){'type'!=e.name&&t.setAttribute(e.name,e.value)}),t.src&&!t.hasAttribute('async')?(t.onload=t.onerror=e,m(t)):(m(t),e()))}()})}(u=function(e,n){c?t(e,n):s.push(e,n)}).all=I,u.js=function(n,t,e,o){u(function(e){(e=p('SCRIPT',t,o)).src=n,m(e)},e)},u.css=function(n,t,e,o){u(function(e){(e=p('LINK',t,o)).rel='stylesheet',e.href=n,m(e)},e)},u.dom=function(e,n,t,o,i){function c(e){o&&!1===o(e)||b(e,t)}u(function(t){t=a in r&&new r[a](function(e){e[d](function(e,n){e.isIntersecting&&(n=e.target)&&(t.unobserve(n),c(n))})},i),y(e||'[data-src]')[d](function(e){l in e||(e[l]=1,t?t.observe(e):c(e))})},n)},u.reveal=b,r.Defer=u,r.addEventListener('on'+e in r?e:n,function(){for(I();s[0];t(s[h](),s[h]()))c=1})}(this,document,setTimeout); \ No newline at end of file +/*!@shinsenter/defer.js@3.6.0*/ +!(function(o,u,s){function f(t,n,e){k?S(t,n):((e=e===s?f.lazy:e)?N:C).push(t,Math.max(e?350:0,n))}function i(t){j.head.appendChild(t)}function a(t,n){t.forEach(function(t){n(t)})}function r(n,t,e,c){a(t.split(" "),function(t){(c||o)[n+"EventListener"](t,e||p)})}function l(t,n,e,c){return(c=n?j.getElementById(n):s)||(c=j.createElement(t),n&&(c.id=n)),e&&r(g,b,e,c),c}function d(t,n){a(q.call(t.attributes),function(t){n(t.name,t.value)})}function h(t,n){return q.call((n||j).querySelectorAll(t))}function m(c,t){a(h("source,img",c),m),d(c,function(t,n,e){(e=/^data-(.+)/.exec(t))&&c[x](e[1],n)}),t&&(c.className+=" "+t),c[b]&&c[b]()}function t(t,n,e){f(function(n){a(n=h(t||"script[type=deferjs]"),function(t,e){t.src&&(e=l(v),d(t,function(t,n){t!=A&&e[x]("src"==t?"href":t,n)}),e.rel="preload",e.as=y,i(e))}),(function c(t,e){(t=n[E]())&&(e=l(y),d(t,function(t,n){t!=A&&e[x](t,n)}),e.text=t.text,t.parentNode.replaceChild(e,t),e.src&&!e.getAttribute("async")?r(g,b+" error",c,e):c())})()},n,e)}function p(t,n){for(n=k?(r(e,c),N):(r(e,w),k=f,N[0]&&r(g,c),C);n[0];)S(n[E](),n[E]())}var v="link",y="script",b="load",n="pageshow",g="add",e="remove",c="touchstart mousemove mousedown keydown wheel",w="on"+n in o?n:b,x="setAttribute",E="shift",A="type",I=o.IntersectionObserver,j=o.document||o,k=/p/.test(j.readyState),C=[],N=[],S=o.setTimeout,q=C.slice;f.all=t,f.dom=function(t,n,o,i,r){f(function(e){function c(t){i&&!1===i(t)||m(t,o)}e=I?new I(function(t){a(t,function(t,n){t.isIntersecting&&(e.unobserve(n=t.target),c(n))})},r):s,a(h(t||"[data-src]"),function(t){t[u]||(t[u]=f,e?e.observe(t):c(t))})},n,!1)},f.css=function(n,e,t,c,o){f(function(t){(t=l(v,e,c)).rel="stylesheet",t.href=n,i(t)},t,o)},f.js=function(n,e,t,c,o){f(function(t){(t=l(y,e,c)).src=n,i(t)},t,o)},f.reveal=m,o[u]=f,k||r(g,w),t()})(this,"Defer"); \ No newline at end of file diff --git a/public/lib/defer_plus.min.js b/public/lib/defer_plus.min.js index 001b977..49ea43a 100644 --- a/public/lib/defer_plus.min.js +++ b/public/lib/defer_plus.min.js @@ -1,2 +1,2 @@ -/*@shinsenter/defer.js@2.5.0*/ -!function(c,i,t){var f,o=/^data-(.+)/,s='IntersectionObserver',r=/p/.test(i.readyState),u=[],a=u.slice,d='deferjs',n='load',e='pageshow',l='forEach',m='shift';function h(e){i.head.appendChild(e)}function p(e,n){a.call(e.attributes)[l](n)}function v(e,n,t,o){return o=(o=n?i.getElementById(n):o)||i.createElement(e),n&&(o.id=n),t&&(o.onload=t),o}function y(e,n){return a.call((n||i).querySelectorAll(e))}function b(t,e){y('source',t)[l](b),p(t,function(e,n){(n=o.exec(e.name))&&(t[n[1]]=e.value)}),e&&(t.className+=' '+e),n in t&&t[n]()}function g(e){f(function(o){o=y(e||'[type=deferjs]'),function e(n,t){(n=o[m]())&&(n.parentNode.removeChild(n),(t=v(n.nodeName)).text=n.text,p(n,function(e){'type'!=e.name&&t.setAttribute(e.name,e.value)}),t.src&&!t.hasAttribute('async')?(t.onload=t.onerror=e,h(t)):(h(t),e()))}()})}(f=function(e,n){r?t(e,n):u.push(e,n)}).all=g,f.js=function(n,t,e,o){f(function(e){(e=v('SCRIPT',t,o)).src=n,h(e)},e)},f.css=function(n,t,e,o){f(function(e){(e=v('LINK',t,o)).rel='stylesheet',e.href=n,h(e)},e)},f.dom=function(e,n,t,o,i){function r(e){o&&!1===o(e)||b(e,t)}f(function(t){t=s in c&&new c[s](function(e){e[l](function(e,n){e.isIntersecting&&(n=e.target)&&(t.unobserve(n),r(n))})},i),y(e||'[data-src]')[l](function(e){d in e||(e[d]=1,t?t.observe(e):r(e))})},n)},f.reveal=b,c.Defer=f,c.addEventListener('on'+e in c?e:n,function(){for(g();u[0];t(u[m](),u[m]()))r=1})}(this,document,setTimeout),function(e,n){e.defer=n=e.Defer,e.deferscript=n.js,e.deferstyle=n.css,e.deferimg=e.deferiframe=n.dom}(this); \ No newline at end of file +/*!@shinsenter/defer.js@3.6.0*/ +!(function(i,u,f){function s(e,t,n){k?N(e,t):((n=n===f?s.lazy:n)?D:C).push(e,Math.max(n?350:0,t))}function o(e){I.head.appendChild(e)}function a(e,t){e.forEach(function(e){t(e)})}function r(t,e,n,c){a(e.split(" "),function(e){(c||i)[t+"EventListener"](e,n||p)})}function l(e,t,n,c){return(c=t?I.getElementById(t):f)||(c=I.createElement(e),t&&(c.id=t)),n&&r(b,g,n,c),c}function d(e,t){a(S.call(e.attributes),function(e){t(e.name,e.value)})}function m(e,t){return S.call((t||I).querySelectorAll(e))}function h(c,e){a(m("source,img",c),h),d(c,function(e,t,n){(n=/^data-(.+)/.exec(e))&&c[x](n[1],t)}),e&&(c.className+=" "+e),c[g]&&c[g]()}function e(e,t,n){s(function(t){a(t=m(e||"script[type=deferjs]"),function(e,n){e.src&&(n=l(y),d(e,function(e,t){e!=j&&n[x]("src"==e?"href":e,t)}),n.rel="preload",n.as=v,o(n))}),(function c(e,n){(e=t[E]())&&(n=l(v),d(e,function(e,t){e!=j&&n[x](e,t)}),n.text=e.text,e.parentNode.replaceChild(n,e),n.src&&!n.getAttribute("async")?r(b,g+" error",c,n):c())})()},t,n)}function p(e,t){for(t=k?(r(n,c),D):(r(n,w),k=s,D[0]&&r(b,c),C);t[0];)N(t[E](),t[E]())}var y="link",v="script",g="load",t="pageshow",b="add",n="remove",c="touchstart mousemove mousedown keydown wheel",w="on"+t in i?t:g,x="setAttribute",E="shift",j="type",A=i.IntersectionObserver,I=i.document||i,k=/p/.test(I.readyState),C=[],D=[],N=i.setTimeout,S=C.slice;s.all=e,s.dom=function(e,t,i,o,r){s(function(n){function c(e){o&&!1===o(e)||h(e,i)}n=A?new A(function(e){a(e,function(e,t){e.isIntersecting&&(n.unobserve(t=e.target),c(t))})},r):f,a(m(e||"[data-src]"),function(e){e[u]||(e[u]=s,n?n.observe(e):c(e))})},t,!1)},s.css=function(t,n,e,c,i){s(function(e){(e=l(y,n,c)).rel="stylesheet",e.href=t,o(e)},e,i)},s.js=function(t,n,e,c,i){s(function(e){(e=l(v,n,c)).src=t,o(e)},e,i)},s.reveal=h,i[u]=s,k||r(b,w),e()})(this,"Defer"),(function(e,t){t=e.defer=e.Defer,e.deferimg=e.deferiframe=t.dom,e.deferstyle=t.css,e.deferscript=t.js})(this); \ No newline at end of file diff --git a/public/lib/polyfill.min.js b/public/lib/polyfill.min.js index 0f5e9dc..44e1476 100644 --- a/public/lib/polyfill.min.js +++ b/public/lib/polyfill.min.js @@ -1 +1 @@ -!function(){'use strict';var p,n,f,d;function r(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch(t){return null}}function u(t){this.time=t.time,this.target=t.target,this.rootBounds=o(t.rootBounds),this.boundingClientRect=o(t.boundingClientRect),this.intersectionRect=o(t.intersectionRect||a()),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,t=e.width*e.height,e=this.intersectionRect,e=e.width*e.height;this.intersectionRatio=t?Number((e/t).toFixed(4)):this.isIntersecting?1:0}function t(t,e){var n,o,i,e=e||{};if('function'!=typeof t)throw new Error('callback must be a function');if(e.root&&1!=e.root.nodeType&&9!=e.root.nodeType)throw new Error('root must be a Document or Element');this._checkForIntersections=(n=this._checkForIntersections.bind(this),o=this.THROTTLE_TIMEOUT,i=null,function(){i=i||setTimeout(function(){n(),i=null},o)}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(e.rootMargin),this.thresholds=this._initThresholds(e.threshold),this.root=e.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(' '),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}function s(t,e,n,o){'function'==typeof t.addEventListener?t.addEventListener(e,n,o||!1):'function'==typeof t.attachEvent&&t.attachEvent('on'+e,n)}function h(t,e,n,o){'function'==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):'function'==typeof t.detatchEvent&&t.detatchEvent('on'+e,n)}function g(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?e.width&&e.height?e:{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}:a()}function a(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function o(t){return!t||'x'in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function m(t,e){var n=e.top-t.top,t=e.left-t.left;return{top:n,left:t,height:e.height,width:e.width,bottom:n+e.height,right:t+e.width}}function i(t,e){for(var n=e;n;){if(n==t)return!0;n=_(n)}return!1}function _(t){var e=t.parentNode;return 9==t.nodeType&&t!=p?r(t):(e=e&&e.assignedSlot?e.assignedSlot.parentNode:e)&&11==e.nodeType&&e.host?e.host:e}function c(t){return t&&9===t.nodeType}'object'==typeof window&&('IntersectionObserver'in window&&'IntersectionObserverEntry'in window&&'intersectionRatio'in window.IntersectionObserverEntry.prototype?'isIntersecting'in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,'isIntersecting',{get:function(){return 0=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -20,10 +20,13 @@ use AppSeeds\Contracts\PatchInterface; /** - * Fix AMP attribute in HTML tag + * Fix AMP attribute in HTML tag. */ -class BugAmpAttribute implements PatchInterface +final class BugAmpAttribute implements PatchInterface { + /** + * @var array + */ private $_tag_backups = []; /** @@ -31,25 +34,27 @@ class BugAmpAttribute implements PatchInterface */ public function before($html, $options) { + if (empty($html)) { + return ''; + } + $find = implode('|', [preg_quote('⚡', '@'), '⚡', 'amp']); $regex = '@(]*)(' . $find . ')([^>]*>)@iu'; if (!empty(preg_match($regex, $html, $matches))) { - $html = preg_replace($regex, '$1amp$3', $html); + $html = preg_replace($regex, '$1amp$3', $html) ?: ''; } - $html = preg_replace_callback( + return preg_replace_callback( '/<(amp-[^\s>]+)[^>]*>.*?(<\/\1>)/si', function ($matches) { - $placeholder = '' . uniqid('@@@AMP@@@:') . ''; + $placeholder = '' . uniqid('@@@AMP@@@:') . ''; $this->_tag_backups[$placeholder] = $matches[0]; return $placeholder; }, $html - ); - - return $html; + ) ?: ''; } /** @@ -57,9 +62,13 @@ function ($matches) { */ public function after($html, $options) { + if (empty($html)) { + return ''; + } + // Restore scripts from backup if (!empty($this->_tag_backups)) { - $html = strtr($html, $this->_tag_backups); + return strtr($html, $this->_tag_backups); } return $html; diff --git a/src/Bugs/BugCharset.php b/src/Bugs/BugCharset.php index 74e9707..9c3ebdb 100644 --- a/src/Bugs/BugCharset.php +++ b/src/Bugs/BugCharset.php @@ -2,14 +2,14 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -20,15 +20,33 @@ use AppSeeds\Contracts\PatchInterface; /** - * Fix document charset + * Fix document charset. */ -class BugCharset implements PatchInterface +final class BugCharset implements PatchInterface { + /** + * @var string + */ const DEFAULT_CHARSET = 'UTF-8'; + + /** + * @var string + */ const ENCODED_CHARSET = 'HTML-ENTITIES'; - protected $charset; + /** + * @var string + */ + const FIND = '/(&#?[a-z0-9]+;)+/'; + + /** + * @var string|null + */ + private $charset; + /** + * @param string|null $charset + */ public function __construct($charset = null) { if ($charset) { @@ -41,14 +59,17 @@ public function __construct($charset = null) */ public function before($html, $options) { + if (empty($html)) { + return ''; + } + if (empty($this->charset)) { $this->charset = $this->detectCharset($html); } - $html = mb_convert_encoding($html, self::ENCODED_CHARSET, $this->charset); - $html = 'charset . '"?>' . $html; + $html = @mb_convert_encoding($html, self::ENCODED_CHARSET, $this->charset); - return $html; + return 'charset . '"?>' . $html; } /** @@ -56,10 +77,14 @@ public function before($html, $options) */ public function after($html, $options) { - $html = preg_replace('/<\?xml[^>]*>/i', '', $html, 1); + if (empty($html)) { + return ''; + } + + $html = preg_replace('/<\?xml[^>]*>/i', '', $html, 1) ?: ''; $charset = $this->charset ?: self::DEFAULT_CHARSET; - $after_charset = mb_detect_encoding($html, mb_detect_order(), true); + $after_charset = @mb_detect_encoding($html, @mb_detect_order(), true); if ($after_charset === false || $after_charset === 'ASCII') { $after_charset = self::ENCODED_CHARSET; @@ -70,29 +95,27 @@ public function after($html, $options) } $cached = []; - $find = '/(&#?[a-z0-9]+;)+/'; $html = preg_replace_callback( - $find, - function ($match) use ($charset, &$cached) { + self::FIND, + static function ($match) use ($charset, &$cached) { $org = $match[0]; - if (isset($cached[$org])) { return $cached[$org]; } - return $cached[$org] = mb_convert_encoding( + return $cached[$org] = @mb_convert_encoding( $org, $charset, self::ENCODED_CHARSET ); }, $html - ); + ) ?: ''; unset($cached); if ($after_charset == self::ENCODED_CHARSET) { - $html = $this->escapeHtmlEntity($html, true); + return $this->escapeHtmlEntity($html, true); } return $html; @@ -108,20 +131,21 @@ public function cleanup() } /** - * Get charset from html - * @param mixed $html + * Get charset from html. + * + * @param string $html */ private function detectCharset($html) { $charset = null; - if (preg_match('@ $mapping, - 'to' => array_map(function ($value) { + 'to' => array_map(static function ($value) { return strtr($value, ['&' => '@&@', ';' => '@;@']); }, $mapping), ]; @@ -161,23 +188,21 @@ private function escapeHtmlEntity($html, $revert = false) // Process the HTML if ($revert) { - $html = strtr( + return strtr( $html, array_combine( $__html_mapping['to'], $__html_mapping['from'] - ) - ); - } else { - $html = strtr( - $html, - array_combine( - $__html_mapping['from'], - $__html_mapping['to'] - ) + ) ?: [] ); } - return $html; + return strtr( + $html, + array_combine( + $__html_mapping['from'], + $__html_mapping['to'] + ) ?: [] + ); } } diff --git a/src/Bugs/BugHtml5DocType.php b/src/Bugs/BugHtml5DocType.php index 5fd19de..4850588 100644 --- a/src/Bugs/BugHtml5DocType.php +++ b/src/Bugs/BugHtml5DocType.php @@ -2,14 +2,14 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -21,18 +21,18 @@ /** * PHP bugs - * Lines longer than 1000 characters break DOMDocument::loadHTML() + * Lines longer than 1000 characters break DocumentNode::loadHTML(). * * @see https://bugs.php.net/bug.php?id=72288 */ -class BugHtml5DocType implements PatchInterface +final class BugHtml5DocType implements PatchInterface { /** * {@inheritdoc} */ public function before($html, $options) { - return $html; + return $html ?: ''; } /** @@ -40,11 +40,14 @@ public function before($html, $options) */ public function after($html, $options) { + if (empty($html)) { + return ''; + } + // Remove XML meta - $html = preg_replace('/<\?xml[^>]*>/i', '', $html, 1); - $html = preg_replace('/]*>/i', '', $html, 1); + $html = preg_replace('/<\?xml[^>]*>/i', '', $html, 1) ?: ''; - return $html; + return preg_replace('/]*>/i', '', $html, 1) ?: ''; } /** diff --git a/src/Bugs/BugLongLine.php b/src/Bugs/BugLongLine.php index 9aeaee8..ef55b00 100644 --- a/src/Bugs/BugLongLine.php +++ b/src/Bugs/BugLongLine.php @@ -2,14 +2,14 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -21,12 +21,15 @@ /** * PHP bugs - * Lines longer than 1000 characters break DOMDocument::loadHTML() + * Lines longer than 1000 characters break DocumentNode::loadHTML(). * * @see https://bugs.php.net/bug.php?id=72288 */ -class BugLongLine implements PatchInterface +final class BugLongLine implements PatchInterface { + /** + * @var string|null + */ private $_bug72288_body; /** @@ -34,6 +37,10 @@ class BugLongLine implements PatchInterface */ public function before($html, $options) { + if (empty($html)) { + return ''; + } + $this->_bug72288_body = preg_match('/(]*>)/mi', $html, $match) ? $match[1] : null; return $html; @@ -44,8 +51,12 @@ public function before($html, $options) */ public function after($html, $options) { + if (empty($html)) { + return ''; + } + if (!empty($this->_bug72288_body)) { - $html = preg_replace('/(]*>)/mi', $this->_bug72288_body, $html, 1); + return preg_replace('/(]*>)/mi', $this->_bug72288_body, $html, 1) ?: ''; } return $html; diff --git a/src/Bugs/BugTemplateScripts.php b/src/Bugs/BugTemplateScripts.php index 41b4622..2ad932c 100644 --- a/src/Bugs/BugTemplateScripts.php +++ b/src/Bugs/BugTemplateScripts.php @@ -2,14 +2,14 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -20,10 +20,13 @@ use AppSeeds\Contracts\PatchInterface; /** - * Escape script tags contain UI templates that break DOMDocument::loadHTML() + * Escape script tags contain UI templates that break DocumentNode::loadHTML(). */ -class BugTemplateScripts implements PatchInterface +final class BugTemplateScripts implements PatchInterface { + /** + * @var array + */ private $_script_backups = []; /** @@ -31,12 +34,16 @@ class BugTemplateScripts implements PatchInterface */ public function before($html, $options) { + if (empty($html)) { + return ''; + } + $type = $options->deferjs_type_attribute; - $html = preg_replace_callback( + return preg_replace_callback( '/(]*>)(.*?)(<\/script>)/si', function ($matches) use ($type) { - $open = strtolower($matches[1]); + $open = strtolower($matches[1]); $content = $matches[2]; // Escape invalid syntax from javascript @@ -55,23 +62,21 @@ function ($matches) use ($type) { // Fix yen symbols to backslashes '/\\\/', - ], ['', '&$1;', '<\/$1>', '\'], trim($content)); + ], ['', '&$1;', '<\/$1>', '\'], trim($content)) ?: ''; } // Backup all scripts contain html-like content if (preg_match('/<\/([^>]*)>/', $content)) { - $placeholder = '/** ' . uniqid('@@@SCRIPT@@@:') . ' **/'; + $placeholder = '/** ' . uniqid('@@@SCRIPT@@@:') . ' **/'; $this->_script_backups[$placeholder] = $content; - $content = $placeholder; + $content = $placeholder; } // Return modified tag - return "{$matches[1]}{$content}{$matches[3]}"; + return sprintf('%s%s%s', $matches[1], $content, $matches[3]); }, $html - ); - - return $html; + ) ?: ''; } /** @@ -79,9 +84,13 @@ function ($matches) use ($type) { */ public function after($html, $options) { + if (empty($html)) { + return ''; + } + // Restore scripts from backup if (!empty($this->_script_backups)) { - $html = strtr($html, $this->_script_backups); + return strtr($html, $this->_script_backups); } return $html; diff --git a/src/Contracts/DeferLazyable.php b/src/Contracts/DeferLazyable.php index e476463..bd8c215 100644 --- a/src/Contracts/DeferLazyable.php +++ b/src/Contracts/DeferLazyable.php @@ -2,14 +2,14 @@ /** * Defer.php aims to help you concentrate on web performance optimization. - * (c) 2021 AppSeeds https://appseeds.net/ + * (c) 2019-2023 SHIN Company https://shin.company * * PHP Version >=5.6 * * @category Web_Performance_Optimization * @package AppSeeds * @author Mai Nhut Tan - * @copyright 2021 AppSeeds + * @copyright 2019-2023 SHIN Company * @license https://code.shin.company/defer.php/blob/master/LICENSE MIT * @link https://code.shin.company/defer.php * @see https://code.shin.company/defer.php/blob/master/README.md @@ -17,22 +17,24 @@ namespace AppSeeds\Contracts; +use AppSeeds\Elements\ElementNode; + interface DeferLazyable { /** - * Apply lazy-load for the element + * Apply lazy-load for the element. */ public function lazyload(); /** - * Get / generate