Created dummy `woocommerce/woocommerce-lib` package to contain dependencies

In order to avoid problems posed by potentially including the unconverted dependencies in the root autoloader, this package will hold all dependencies that require conflict avoidance.
This commit is contained in:
Christopher Allford 2020-11-18 13:54:20 -08:00
parent 846a7fb3d1
commit c9f413d297
45 changed files with 566 additions and 210 deletions

3
.gitignore vendored
View File

@ -59,7 +59,8 @@ tests/cli/vendor
# Composer # Composer
/vendor/ /vendor/
/bin/composer/**/vendor /bin/composer/**/vendor/
/lib/vendor/
contributors.md contributors.md
contributors.html contributors.html

View File

@ -20,14 +20,16 @@ if [ -z "$(php -r "echo version_compare(PHP_VERSION,'7.2','>=');")" ]; then
exit 1 exit 1
fi fi
output 6 "Moving the appropriate vendor packages to Automattic\WooCommerce\Internal\Vendor" output 6 "Building lib package"
# Delete the entire contents of src/Internal/Vendor, except README.md # Clean the output directories to remove any files not present anymore
find src/Internal/Vendor/* ! -name README.md -prune -exec rm -rf {} + rm -rf lib/packages lib/classes
mkdir lib/packages lib/classes
# Move the appropriate vendor packages to src/Internal/Vendor # Running update on the lib package will automatically run Mozart
# (see extra/mozart for configuration) pushd ./lib
./vendor/bin/mozart compose || exit "$?" composer update
popd
output 6 "Updating autoload files" output 6 "Updating autoload files"

View File

@ -32,6 +32,7 @@
"phpunit/phpunit": "^8.5", "phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5" "squizlabs/php_codesniffer": "^3.5"
}, },
"default-branch": true,
"bin": [ "bin": [
"bin/mozart" "bin/mozart"
], ],
@ -52,6 +53,10 @@
} }
], ],
"description": "Composes all dependencies as a package inside a WordPress plugin", "description": "Composes all dependencies as a package inside a WordPress plugin",
"support": {
"issues": "https://github.com/coenjacobs/mozart/issues",
"source": "https://github.com/coenjacobs/mozart/tree/master"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/coenjacobs", "url": "https://github.com/coenjacobs",
@ -142,6 +147,10 @@
"sftp", "sftp",
"storage" "storage"
], ],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/1.0.70"
},
"funding": [ "funding": [
{ {
"url": "https://offset.earth/frankdejonge", "url": "https://offset.earth/frankdejonge",
@ -197,6 +206,10 @@
"container-interop", "container-interop",
"psr" "psr"
], ],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
},
"time": "2017-02-14T16:28:37+00:00" "time": "2017-02-14T16:28:37+00:00"
}, },
{ {
@ -269,6 +282,9 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/console/tree/v4.4.16"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -327,6 +343,9 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v4.4.16"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -404,6 +423,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -480,6 +502,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -560,6 +585,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -636,6 +664,9 @@
"interoperability", "interoperability",
"standards" "standards"
], ],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v1.1.9"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -665,5 +696,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.2" "php": "7.2"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -71,6 +71,10 @@
"stylecheck", "stylecheck",
"tests" "tests"
], ],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-06-25T14:57:39+00:00" "time": "2020-06-25T14:57:39+00:00"
}, },
{ {
@ -129,6 +133,10 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00" "time": "2019-12-27T09:44:58+00:00"
}, },
{ {
@ -181,6 +189,10 @@
"polyfill", "polyfill",
"standards" "standards"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
},
"time": "2019-11-04T15:17:54+00:00" "time": "2019-11-04T15:17:54+00:00"
}, },
{ {
@ -231,6 +243,10 @@
"standards", "standards",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2019-08-28T14:22:28+00:00" "time": "2019-08-28T14:22:28+00:00"
}, },
{ {
@ -282,6 +298,11 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2020-10-23T02:01:07+00:00" "time": "2020-10-23T02:01:07+00:00"
}, },
{ {
@ -322,6 +343,10 @@
"woocommerce", "woocommerce",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-sniffs/issues",
"source": "https://github.com/woocommerce/woocommerce-sniffs/tree/master"
},
"time": "2020-08-06T18:23:45+00:00" "time": "2020-08-06T18:23:45+00:00"
}, },
{ {
@ -368,6 +393,11 @@
"standards", "standards",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
"source": "https://github.com/WordPress/WordPress-Coding-Standards",
"wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
},
"time": "2020-05-13T23:57:56+00:00" "time": "2020-05-13T23:57:56+00:00"
} }
], ],
@ -381,5 +411,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -332,6 +332,10 @@
} }
], ],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x"
},
"time": "2019-12-28T18:55:12+00:00" "time": "2019-12-28T18:55:12+00:00"
}, },
{ {
@ -444,6 +448,10 @@
"spy", "spy",
"stub" "stub"
], ],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00" "time": "2020-03-05T15:02:03+00:00"
}, },
{ {
@ -604,6 +612,10 @@
"keywords": [ "keywords": [
"template" "template"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
},
"time": "2015-06-21T13:50:34+00:00" "time": "2015-06-21T13:50:34+00:00"
}, },
{ {
@ -908,6 +920,10 @@
], ],
"description": "Looks up which function or method a line of code belongs to", "description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/master"
},
"time": "2017-03-04T06:30:41+00:00" "time": "2017-03-04T06:30:41+00:00"
}, },
{ {
@ -1153,6 +1169,10 @@
"export", "export",
"exporter" "exporter"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/master"
},
"time": "2019-09-14T09:02:43+00:00" "time": "2019-09-14T09:02:43+00:00"
}, },
{ {
@ -1204,6 +1224,10 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0"
},
"time": "2017-04-27T15:39:26+00:00" "time": "2017-04-27T15:39:26+00:00"
}, },
{ {
@ -1251,6 +1275,10 @@
], ],
"description": "Traverses array structures and object graphs to enumerate all referenced objects", "description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/", "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/master"
},
"time": "2017-08-03T12:35:26+00:00" "time": "2017-08-03T12:35:26+00:00"
}, },
{ {
@ -1296,6 +1324,10 @@
], ],
"description": "Allows reflection of object attributes, including inherited and non-public ones", "description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/", "homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/master"
},
"time": "2017-03-29T09:07:27+00:00" "time": "2017-03-29T09:07:27+00:00"
}, },
{ {
@ -1349,6 +1381,10 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
},
"time": "2017-03-03T06:23:57+00:00" "time": "2017-03-03T06:23:57+00:00"
}, },
{ {
@ -1438,6 +1474,10 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"support": {
"issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/master"
},
"time": "2016-10-03T07:35:21+00:00" "time": "2016-10-03T07:35:21+00:00"
}, },
{ {
@ -1557,6 +1597,10 @@
} }
], ],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00" "time": "2019-06-13T22:48:21+00:00"
}, },
{ {
@ -1606,6 +1650,10 @@
"check", "check",
"validate" "validate"
], ],
"support": {
"issues": "https://github.com/webmozart/assert/issues",
"source": "https://github.com/webmozart/assert/tree/master"
},
"time": "2020-07-08T17:02:28+00:00" "time": "2020-07-08T17:02:28+00:00"
} }
], ],
@ -1619,5 +1667,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -67,6 +67,11 @@
"po", "po",
"translation" "translation"
], ],
"support": {
"email": "oom@oscarotero.com",
"issues": "https://github.com/oscarotero/Gettext/issues",
"source": "https://github.com/php-gettext/Gettext/tree/v4.8.2"
},
"time": "2019-12-02T10:21:14+00:00" "time": "2019-12-02T10:21:14+00:00"
}, },
{ {
@ -128,6 +133,10 @@
"translations", "translations",
"unicode" "unicode"
], ],
"support": {
"issues": "https://github.com/php-gettext/Languages/issues",
"source": "https://github.com/php-gettext/Languages/tree/2.6.0"
},
"time": "2019-11-13T10:30:21+00:00" "time": "2019-11-13T10:30:21+00:00"
}, },
{ {
@ -173,6 +182,10 @@
} }
], ],
"description": "Peast is PHP library that generates AST for JavaScript code", "description": "Peast is PHP library that generates AST for JavaScript code",
"support": {
"issues": "https://github.com/mck89/peast/issues",
"source": "https://github.com/mck89/peast/tree/v1.11.0"
},
"time": "2020-10-09T15:12:13+00:00" "time": "2020-10-09T15:12:13+00:00"
}, },
{ {
@ -219,6 +232,10 @@
"mustache", "mustache",
"templating" "templating"
], ],
"support": {
"issues": "https://github.com/bobthecow/mustache.php/issues",
"source": "https://github.com/bobthecow/mustache.php/tree/master"
},
"time": "2019-11-23T21:40:31+00:00" "time": "2019-11-23T21:40:31+00:00"
}, },
{ {
@ -268,6 +285,10 @@
"iri", "iri",
"sockets" "sockets"
], ],
"support": {
"issues": "https://github.com/rmccue/Requests/issues",
"source": "https://github.com/rmccue/Requests/tree/master"
},
"time": "2016-10-13T00:11:37+00:00" "time": "2016-10-13T00:11:37+00:00"
}, },
{ {
@ -377,6 +398,10 @@
], ],
"description": "Provides internationalization tools for WordPress projects.", "description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command", "homepage": "https://github.com/wp-cli/i18n-command",
"support": {
"issues": "https://github.com/wp-cli/i18n-command/issues",
"source": "https://github.com/wp-cli/i18n-command/tree/master"
},
"time": "2020-07-08T15:20:38+00:00" "time": "2020-07-08T15:20:38+00:00"
}, },
{ {
@ -425,6 +450,9 @@
], ],
"description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)",
"homepage": "https://github.com/mustangostang/spyc/", "homepage": "https://github.com/mustangostang/spyc/",
"support": {
"source": "https://github.com/wp-cli/spyc/tree/autoload"
},
"time": "2017-04-25T11:26:20+00:00" "time": "2017-04-25T11:26:20+00:00"
}, },
{ {
@ -475,6 +503,10 @@
"cli", "cli",
"console" "console"
], ],
"support": {
"issues": "https://github.com/wp-cli/php-cli-tools/issues",
"source": "https://github.com/wp-cli/php-cli-tools/tree/master"
},
"time": "2018-09-04T13:28:00+00:00" "time": "2018-09-04T13:28:00+00:00"
}, },
{ {
@ -537,6 +569,11 @@
"cli", "cli",
"wordpress" "wordpress"
], ],
"support": {
"docs": "https://make.wordpress.org/cli/handbook/",
"issues": "https://github.com/wp-cli/wp-cli/issues",
"source": "https://github.com/wp-cli/wp-cli"
},
"time": "2020-02-18T08:15:37+00:00" "time": "2020-02-18T08:15:37+00:00"
} }
], ],
@ -550,5 +587,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -6,6 +6,12 @@
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"prefer-stable": true, "prefer-stable": true,
"minimum-stability": "dev", "minimum-stability": "dev",
"repositories": [
{
"type": "path",
"url": "lib"
}
],
"require": { "require": {
"php": ">=7.0", "php": ">=7.0",
"automattic/jetpack-autoloader": "2.2.0", "automattic/jetpack-autoloader": "2.2.0",
@ -17,11 +23,10 @@
"woocommerce/action-scheduler": "3.1.6", "woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "1.7.0", "woocommerce/woocommerce-admin": "1.7.0",
"woocommerce/woocommerce-blocks": "3.8.0", "woocommerce/woocommerce-blocks": "3.8.0",
"league/container": "3.3.3" "woocommerce/woocommerce-lib": "@dev"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.4", "bamarni/composer-bin-plugin": "^1.4"
"league/container": "3.3.3"
}, },
"config": { "config": {
"platform": { "platform": {
@ -85,8 +90,8 @@
"bin": [ "bin": [
"echo 'bin not installed'" "echo 'bin not installed'"
], ],
"move-vendor-packages": [ "build-lib": [
"sh ./bin/move-vendor-packages.sh" "sh ./bin/build-lib.sh"
] ]
}, },
"extra": { "extra": {
@ -106,19 +111,6 @@
}, },
"bamarni-bin": { "bamarni-bin": {
"target-directory": "bin/composer" "target-directory": "bin/composer"
},
"mozart": {
"dep_namespace": "Automattic\\WooCommerce\\Internal\\Vendor\\",
"dep_directory": "/src/Internal/Vendor/",
"packages": [
"league/container"
],
"excluded_packages": [
"psr/container"
],
"classmap_directory": "/classmaps",
"classmap_prefix": "WOO_",
"delete_vendor_directories": true
} }
} }
} }

160
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0373a0a4d2df08885d048edab884822b", "content-hash": "cf86e77a0dae2549e3e8060ae85f8af7",
"packages": [ "packages": [
{ {
"name": "automattic/jetpack-autoloader", "name": "automattic/jetpack-autoloader",
@ -40,6 +40,9 @@
"GPL-2.0-or-later" "GPL-2.0-or-later"
], ],
"description": "Creates a custom autoloader for a plugin or theme.", "description": "Creates a custom autoloader for a plugin or theme.",
"support": {
"source": "https://github.com/Automattic/jetpack-autoloader/tree/master"
},
"time": "2020-08-14T20:34:36+00:00" "time": "2020-08-14T20:34:36+00:00"
}, },
{ {
@ -71,6 +74,9 @@
"GPL-2.0-or-later" "GPL-2.0-or-later"
], ],
"description": "A wrapper for defining constants in a more testable way.", "description": "A wrapper for defining constants in a more testable way.",
"support": {
"source": "https://github.com/Automattic/jetpack-constants/tree/master"
},
"time": "2020-08-13T14:33:09+00:00" "time": "2020-08-13T14:33:09+00:00"
}, },
{ {
@ -214,78 +220,6 @@
], ],
"time": "2020-04-07T06:57:05+00:00" "time": "2020-04-07T06:57:05+00:00"
}, },
{
"name": "league/container",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/container.git",
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/container/zipball/7dc67bdf89efc338e674863c0ea70a63efe4de05",
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/container": "^1.0"
},
"provide": {
"psr/container-implementation": "^1.0"
},
"replace": {
"orno/di": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-3.x": "3.x-dev",
"dev-2.x": "2.x-dev",
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Container\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Phil Bennett",
"email": "philipobenito@gmail.com",
"homepage": "http://www.philipobenito.com",
"role": "Developer"
}
],
"description": "A fast and intuitive dependency injection container.",
"homepage": "https://github.com/thephpleague/container",
"keywords": [
"container",
"dependency",
"di",
"injection",
"league",
"provider",
"service"
],
"funding": [
{
"url": "https://github.com/philipobenito",
"type": "github"
}
],
"time": "2020-09-28T13:38:44+00:00"
},
{ {
"name": "maxmind-db/reader", "name": "maxmind-db/reader",
"version": "v1.6.0", "version": "v1.6.0",
@ -344,6 +278,10 @@
"geolocation", "geolocation",
"maxmind" "maxmind"
], ],
"support": {
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0"
},
"time": "2019-12-19T22:59:03+00:00" "time": "2019-12-19T22:59:03+00:00"
}, },
{ {
@ -418,6 +356,10 @@
"email", "email",
"pre-processing" "pre-processing"
], ],
"support": {
"issues": "https://github.com/MyIntervals/emogrifier/issues",
"source": "https://github.com/MyIntervals/emogrifier"
},
"time": "2019-12-26T19:37:31+00:00" "time": "2019-12-26T19:37:31+00:00"
}, },
{ {
@ -467,6 +409,10 @@
"container-interop", "container-interop",
"psr" "psr"
], ],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
},
"time": "2017-02-14T16:28:37+00:00" "time": "2017-02-14T16:28:37+00:00"
}, },
{ {
@ -558,6 +504,10 @@
], ],
"description": "Action Scheduler for WordPress and WooCommerce", "description": "Action Scheduler for WordPress and WooCommerce",
"homepage": "https://actionscheduler.org/", "homepage": "https://actionscheduler.org/",
"support": {
"issues": "https://github.com/woocommerce/action-scheduler/issues",
"source": "https://github.com/woocommerce/action-scheduler/tree/master"
},
"time": "2020-05-12T16:22:33+00:00" "time": "2020-05-12T16:22:33+00:00"
}, },
{ {
@ -659,6 +609,60 @@
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v3.8.0" "source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v3.8.0"
}, },
"time": "2020-11-10T15:07:11+00:00" "time": "2020-11-10T15:07:11+00:00"
},
{
"name": "woocommerce/woocommerce-lib",
"version": "dev-use-mozart-to-renamespace-dependencies",
"dist": {
"type": "path",
"url": "lib",
"reference": "d9d4733f0ed94289ad50fdf98cb4bc028384f482"
},
"require": {
"php": ">=7.0",
"psr/container": "^1.0"
},
"require-dev": {
"league/container": "3.3.3"
},
"type": "library",
"extra": {
"mozart": {
"dep_namespace": "Automattic\\WooCommerce\\Vendor\\",
"dep_directory": "/packages/",
"packages": [
"league/container"
],
"excluded_packages": [
"psr/container"
],
"classmap_directory": "/classes/",
"classmap_prefix": "WC_",
"delete_vendor_directories": false
}
},
"autoload": {
"psr-4": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
},
"psr-0": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
}
},
"scripts": {
"post-install-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
],
"post-update-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
]
},
"description": "A package for hiding re-namespaced dependencies and executing them",
"transport-options": {
"relative": true
}
} }
], ],
"packages-dev": [ "packages-dev": [
@ -706,12 +710,18 @@
"isolation", "isolation",
"tool" "tool"
], ],
"support": {
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
"source": "https://github.com/bamarni/composer-bin-plugin/tree/master"
},
"time": "2020-05-03T08:27:20+00:00" "time": "2020-05-03T08:27:20+00:00"
} }
], ],
"aliases": [], "aliases": [],
"minimum-stability": "dev", "minimum-stability": "dev",
"stability-flags": [], "stability-flags": {
"woocommerce/woocommerce-lib": 20
},
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
@ -721,5 +731,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

31
lib/README.md Normal file
View File

@ -0,0 +1,31 @@
## WooCommerce Lib Directory
This directory contains a dummy package responsible for managing WooCommerce dependencies that require conflict avoidance.
The contents of the `packages` and `classes` directories get automatically generated by `composer install` and `composer update`.
This allows us to prefix namespaces and classmap classes to avoid conflicts with plugins that include the same package.
All namespaces are prefixed with `Automattic\WooCommerce\Vendor` and classmap classes prefixed with `WC_Vendor_`.
**_Do not_ make direct changes in the files contained in `packages` or `classes`! Any changes will be lost!**
### Adding Packages
In order to avoid including the original dependencies in the root autoloader we must utilize `require-dev` for them.
Composer treats `require` dependencies as transitive while `require-dev` dependencies get ignored by consumers.
1. Add package to `require-dev` section of `composer.json`
2. Add package slug to `extra/mozart/packages` section of `composer.json`
3. Run `composer run-script build-lib` from the root directory (You should now see the package in `packages/VendorName/PackageName` or `classes`)
### Updating Packages
Updating a package is as easy as changing the version in `composer.json` and then running `composer run-script build-lib` from the root directory.
### Ignoring Packages
If you would like to add a package which does not undergo conflict avoidance you must take steps to ensure it appears in
the root autoloader.
1. Add package to `require` instead of `require-dev` (This allows it to be pulled transitively)
2. Add package slug to `extra/mozart/excluded-packages` section of `composer.json`
3. Run `composer run-script build-lib` from the root directory (You **should not** see the package in `packages/VendorName/PackageName` or `classes`)

51
lib/composer.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "woocommerce/woocommerce-lib",
"description": "A package for hiding re-namespaced dependencies and executing them",
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": ">=7.0",
"psr/container": "^1.0"
},
"require-dev": {
"league/container": "3.3.3"
},
"autoload": {
"psr-4": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
},
"psr-0": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
}
},
"config": {
"platform": {
"php": "7.0"
}
},
"scripts": {
"post-install-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
],
"post-update-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
]
},
"extra": {
"mozart": {
"dep_namespace": "Automattic\\WooCommerce\\Vendor\\",
"dep_directory": "/packages/",
"packages": [
"league/container"
],
"excluded_packages": [
"psr/container"
],
"classmap_directory": "/classes/",
"classmap_prefix": "WC_Vendor_",
"delete_vendor_directories": false
}
}
}

154
lib/composer.lock generated Normal file
View File

@ -0,0 +1,154 @@
{
"_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": "998898140bfcf00b7d3a9b793ecfba72",
"packages": [
{
"name": "psr/container",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://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/master"
},
"time": "2017-02-14T16:28:37+00:00"
}
],
"packages-dev": [
{
"name": "league/container",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/container.git",
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/container/zipball/7dc67bdf89efc338e674863c0ea70a63efe4de05",
"reference": "7dc67bdf89efc338e674863c0ea70a63efe4de05",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/container": "^1.0"
},
"provide": {
"psr/container-implementation": "^1.0"
},
"replace": {
"orno/di": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-3.x": "3.x-dev",
"dev-2.x": "2.x-dev",
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Container\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Phil Bennett",
"email": "philipobenito@gmail.com",
"homepage": "http://www.philipobenito.com",
"role": "Developer"
}
],
"description": "A fast and intuitive dependency injection container.",
"homepage": "https://github.com/thephpleague/container",
"keywords": [
"container",
"dependency",
"di",
"injection",
"league",
"provider",
"service"
],
"support": {
"issues": "https://github.com/thephpleague/container/issues",
"source": "https://github.com/thephpleague/container/tree/3.3.3"
},
"funding": [
{
"url": "https://github.com/philipobenito",
"type": "github"
}
],
"time": "2020-09-28T13:38:44+00:00"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=7.0"
},
"platform-dev": [],
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "2.0.0"
}

View File

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
use ReflectionFunctionAbstract; use ReflectionFunctionAbstract;
interface ArgumentResolverInterface extends ContainerAwareInterface interface ArgumentResolverInterface extends ContainerAwareInterface

View File

@ -1,10 +1,10 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Container; use Automattic\WooCommerce\Vendor\League\Container\Container;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\{ContainerException, NotFoundException}; use Automattic\WooCommerce\Vendor\League\Container\Exception\{ContainerException, NotFoundException};
use Automattic\WooCommerce\Internal\Vendor\League\Container\ReflectionContainer; use Automattic\WooCommerce\Vendor\League\Container\ReflectionContainer;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use ReflectionFunctionAbstract; use ReflectionFunctionAbstract;
use ReflectionParameter; use ReflectionParameter;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
class ClassName implements ClassNameInterface class ClassName implements ClassNameInterface
{ {

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
interface ClassNameInterface interface ClassNameInterface
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
class ClassNameWithOptionalValue implements ClassNameInterface class ClassNameWithOptionalValue implements ClassNameInterface
{ {

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
class RawArgument implements RawArgumentInterface class RawArgument implements RawArgumentInterface
{ {

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Argument; namespace Automattic\WooCommerce\Vendor\League\Container\Argument;
interface RawArgumentInterface interface RawArgumentInterface
{ {

View File

@ -1,11 +1,11 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container; namespace Automattic\WooCommerce\Vendor\League\Container;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\{DefinitionAggregate, DefinitionInterface, DefinitionAggregateInterface}; use Automattic\WooCommerce\Vendor\League\Container\Definition\{DefinitionAggregate, DefinitionInterface, DefinitionAggregateInterface};
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\{NotFoundException, ContainerException}; use Automattic\WooCommerce\Vendor\League\Container\Exception\{NotFoundException, ContainerException};
use Automattic\WooCommerce\Internal\Vendor\League\Container\Inflector\{InflectorAggregate, InflectorInterface, InflectorAggregateInterface}; use Automattic\WooCommerce\Vendor\League\Container\Inflector\{InflectorAggregate, InflectorInterface, InflectorAggregateInterface};
use Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider\{ use Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\{
ServiceProviderAggregate, ServiceProviderAggregate,
ServiceProviderAggregateInterface, ServiceProviderAggregateInterface,
ServiceProviderInterface ServiceProviderInterface

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container; namespace Automattic\WooCommerce\Vendor\League\Container;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;

View File

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container; namespace Automattic\WooCommerce\Vendor\League\Container;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\ContainerException; use Automattic\WooCommerce\Vendor\League\Container\Exception\ContainerException;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
trait ContainerAwareTrait trait ContainerAwareTrait

View File

@ -1,11 +1,11 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Definition; namespace Automattic\WooCommerce\Vendor\League\Container\Definition;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Argument\{ use Automattic\WooCommerce\Vendor\League\Container\Argument\{
ArgumentResolverInterface, ArgumentResolverTrait, ClassNameInterface, RawArgumentInterface ArgumentResolverInterface, ArgumentResolverTrait, ClassNameInterface, RawArgumentInterface
}; };
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareTrait; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
use ReflectionClass; use ReflectionClass;
use ReflectionException; use ReflectionException;

View File

@ -1,10 +1,10 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Definition; namespace Automattic\WooCommerce\Vendor\League\Container\Definition;
use Generator; use Generator;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareTrait; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\NotFoundException; use Automattic\WooCommerce\Vendor\League\Container\Exception\NotFoundException;
class DefinitionAggregate implements DefinitionAggregateInterface class DefinitionAggregate implements DefinitionAggregateInterface
{ {

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Definition; namespace Automattic\WooCommerce\Vendor\League\Container\Definition;
use IteratorAggregate; use IteratorAggregate;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
interface DefinitionAggregateInterface extends ContainerAwareInterface, IteratorAggregate interface DefinitionAggregateInterface extends ContainerAwareInterface, IteratorAggregate
{ {

View File

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Definition; namespace Automattic\WooCommerce\Vendor\League\Container\Definition;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
interface DefinitionInterface extends ContainerAwareInterface interface DefinitionInterface extends ContainerAwareInterface
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Exception; namespace Automattic\WooCommerce\Vendor\League\Container\Exception;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use RuntimeException; use RuntimeException;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Exception; namespace Automattic\WooCommerce\Vendor\League\Container\Exception;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use InvalidArgumentException; use InvalidArgumentException;

View File

@ -1,10 +1,10 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Inflector; namespace Automattic\WooCommerce\Vendor\League\Container\Inflector;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Argument\ArgumentResolverInterface; use Automattic\WooCommerce\Vendor\League\Container\Argument\ArgumentResolverInterface;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Argument\ArgumentResolverTrait; use Automattic\WooCommerce\Vendor\League\Container\Argument\ArgumentResolverTrait;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareTrait; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
class Inflector implements ArgumentResolverInterface, InflectorInterface class Inflector implements ArgumentResolverInterface, InflectorInterface
{ {

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Inflector; namespace Automattic\WooCommerce\Vendor\League\Container\Inflector;
use Generator; use Generator;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareTrait; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
class InflectorAggregate implements InflectorAggregateInterface class InflectorAggregate implements InflectorAggregateInterface
{ {

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Inflector; namespace Automattic\WooCommerce\Vendor\League\Container\Inflector;
use IteratorAggregate; use IteratorAggregate;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
interface InflectorAggregateInterface extends ContainerAwareInterface, IteratorAggregate interface InflectorAggregateInterface extends ContainerAwareInterface, IteratorAggregate
{ {

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\Inflector; namespace Automattic\WooCommerce\Vendor\League\Container\Inflector;
interface InflectorInterface interface InflectorInterface
{ {

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container; namespace Automattic\WooCommerce\Vendor\League\Container;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Argument\{ArgumentResolverInterface, ArgumentResolverTrait}; use Automattic\WooCommerce\Vendor\League\Container\Argument\{ArgumentResolverInterface, ArgumentResolverTrait};
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\NotFoundException; use Automattic\WooCommerce\Vendor\League\Container\Exception\NotFoundException;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use ReflectionClass; use ReflectionClass;
use ReflectionException; use ReflectionException;

View File

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider; namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareTrait; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
abstract class AbstractServiceProvider implements ServiceProviderInterface abstract class AbstractServiceProvider implements ServiceProviderInterface
{ {

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider; namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
interface BootableServiceProviderInterface extends ServiceProviderInterface interface BootableServiceProviderInterface extends ServiceProviderInterface
{ {

View File

@ -1,10 +1,10 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider; namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
use Generator; use Generator;
use Automattic\WooCommerce\Internal\Vendor\League\Container\{ContainerAwareInterface, ContainerAwareTrait}; use Automattic\WooCommerce\Vendor\League\Container\{ContainerAwareInterface, ContainerAwareTrait};
use Automattic\WooCommerce\Internal\Vendor\League\Container\Exception\ContainerException; use Automattic\WooCommerce\Vendor\League\Container\Exception\ContainerException;
class ServiceProviderAggregate implements ServiceProviderAggregateInterface class ServiceProviderAggregate implements ServiceProviderAggregateInterface
{ {
@ -51,7 +51,7 @@ class ServiceProviderAggregate implements ServiceProviderAggregateInterface
throw new ContainerException( throw new ContainerException(
'A service provider must be a fully qualified class name or instance ' . 'A service provider must be a fully qualified class name or instance ' .
'of (\Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider\ServiceProviderInterface)' 'of (\Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\ServiceProviderInterface)'
); );
} }

View File

@ -1,9 +1,9 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider; namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
use IteratorAggregate; use IteratorAggregate;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
interface ServiceProviderAggregateInterface extends ContainerAwareInterface, IteratorAggregate interface ServiceProviderAggregateInterface extends ContainerAwareInterface, IteratorAggregate
{ {

View File

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider; namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
use Automattic\WooCommerce\Internal\Vendor\League\Container\ContainerAwareInterface; use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareInterface;
interface ServiceProviderInterface extends ContainerAwareInterface interface ServiceProviderInterface extends ContainerAwareInterface
{ {

View File

@ -14,6 +14,7 @@
<exclude-pattern>includes/wc-deprecated-functions.php</exclude-pattern> <exclude-pattern>includes/wc-deprecated-functions.php</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern> <exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern> <exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>lib/</exclude-pattern>
<!-- Show progress, show the error codes for each message (source). --> <!-- Show progress, show the error codes for each message (source). -->
<arg value="ps" /> <arg value="ps" />

View File

@ -5,8 +5,9 @@
namespace Automattic\WooCommerce\Internal\DependencyManagement; namespace Automattic\WooCommerce\Internal\DependencyManagement;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Argument\RawArgument; use Automattic\WooCommerce\Vendor\League\Container\Argument\RawArgument;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\DefinitionInterface; use Automattic\WooCommerce\Vendor\League\Container\Definition\DefinitionInterface;
use Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\AbstractServiceProvider as BaseServiceProvider;
/** /**
* Base class for the service providers used to register classes in the container. * Base class for the service providers used to register classes in the container.
@ -18,7 +19,7 @@ use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\Definitio
* - The `share_with_auto_arguments` method, sibling of the above. * - The `share_with_auto_arguments` method, sibling of the above.
* - Convenience `add` and `share` methods that are just proxies for the same methods in `$this->getContainer()`. * - Convenience `add` and `share` methods that are just proxies for the same methods in `$this->getContainer()`.
*/ */
abstract class AbstractServiceProvider extends \Automattic\WooCommerce\Internal\Vendor\League\Container\ServiceProvider\AbstractServiceProvider { abstract class AbstractServiceProvider extends BaseServiceProvider {
/** /**
* Register a class in the container and use reflection to guess the injection method arguments. * Register a class in the container and use reflection to guess the injection method arguments.

View File

@ -5,7 +5,7 @@
namespace Automattic\WooCommerce\Internal\DependencyManagement; namespace Automattic\WooCommerce\Internal\DependencyManagement;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\Definition as BaseDefinition; use Automattic\WooCommerce\Vendor\League\Container\Definition\Definition as BaseDefinition;
/** /**
* An extension of the definition class that replaces constructor injection with method injection. * An extension of the definition class that replaces constructor injection with method injection.

View File

@ -6,8 +6,8 @@
namespace Automattic\WooCommerce\Internal\DependencyManagement; namespace Automattic\WooCommerce\Internal\DependencyManagement;
use Automattic\WooCommerce\Utilities\StringUtil; use Automattic\WooCommerce\Utilities\StringUtil;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Container as BaseContainer; use Automattic\WooCommerce\Vendor\League\Container\Container as BaseContainer;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\DefinitionInterface; use Automattic\WooCommerce\Vendor\League\Container\Definition\DefinitionInterface;
/** /**
* This class extends the original League's Container object by adding some functionality * This class extends the original League's Container object by adding some functionality

View File

@ -1,45 +0,0 @@
## Vendor files directory
The contents of this directory are automatically generated by moving some of the packages in the `vendor` directory and prefixing the namespace of their classes with `Automattic\WooCommerce\Internal\Vendor`, right after `composer install/update` finishes. This is done to prevent conflicts with plugins using the same packages.
**Do no** make manual changes in the files here. Such changes will be lost the next time the contents are regenerated.
### Registering packages to be moved
If you want to register a vendor package for being moved to the `Automattic\WooCommerce\Internal\Vendor` namespace in order to avoid possible namespace conflicts, follow these steps:
1. Add the package to the `require-dev` section in `composer.json`. If the package was already listed in `require`, remove it.
2. Add the package to the `extra/mozart/packages` section in `composer.json` too, note that this time you add only the package slug (not the version).
3. Run `composer update`.
4. Run `composer run move-vendor-packages`.
5. Notice that a new folder `VendorName/PackageName` has been added to `src/Internal/Vendor`. Add it to source control.
6. All the namespaces in the moved code will have been prefixed with `Automattic\WooCommerce\Internal\Vendor`, so if you already had code that made use of the package, you'll need to adjust it accordingly.
The `composer run move-vendor-packages` command uses the [coenjacobs/mozart](https://github.com/coenjacobs/mozart) package, which requires PHP 7.2 or newer.
### Updating packages
If you want to update any of the moved packages to a new version, repeat steps 3 to 5 above.
### Preventing a dependency from being moved
If you want to prevent a package dependency from being moved and thus re-namespaced (for example, we use a moved `league/container` package but it has a dependency on `psr/container` which we don't want to be moved) you need to follow these additional steps after 2 above:
2.1. Add the dependency to the `require` section in `composer.json`. Yes, this time it's `require`, not `require-dev`.
2.2. Add the dependency to the `extra/mozart/excluded-packages` section in `composer.json` too (again, the slug only).
### Why adding the packages to be moved to require-dev?
Once a package has been moved it's no longer needed in the `vendor` directory, so we don't want it to be there when we build WooCommerce into a zip file (we want that zip file to be as small as possible).
Fortunately, the `npm run build` command executes `composer install --no-dev` before generating the zip file. Therefore, by adding the package to `require-dev` we make sure that the package will not be present in the `vendor` directory in the generated zip.
The package will still be in `vendor` when you run `composer update/install` in your development environment, but you are free to just ignore it. Note that `composer run move-vendor-packages` will effectively remove the package from `vendor`, but that's not a command you will normally need to run.

5
src/Vendor/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Prevent anyone from accidentally adding code to these directories.
# This will break any PRs that do, revealing ths mistake they made.
README.md
!.gitignore
!README.md

7
src/Vendor/README.md vendored Normal file
View File

@ -0,0 +1,7 @@
# WARNING
The namespace of this folder belongs to our dummy [lib package](./../lib/README.md) to manage conflict avoidance.
No files should be added here!
These are **internal** dependencies and **should not** be considered backwards compatible! Developers should not
use these files outside of WooCommerce Core as they are subject to change.

View File

@ -15,7 +15,7 @@ use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\Cl
use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\ClassWithPrivateInjectionMethod; use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\ClassWithPrivateInjectionMethod;
use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\ClassWithScalarInjectionMethodArgument; use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\ClassWithScalarInjectionMethodArgument;
use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\DependencyClass; use Automattic\WooCommerce\Tests\Internal\DependencyManagement\ExampleClasses\DependencyClass;
use Automattic\WooCommerce\Internal\Vendor\League\Container\Definition\DefinitionInterface; use Automattic\WooCommerce\Vendor\League\Container\Definition\DefinitionInterface;
/** /**
* Tests for AbstractServiceProvider. * Tests for AbstractServiceProvider.