aboutsummaryrefslogtreecommitdiffstats
path: root/includes/resourceloader/ResourceLoaderFileModule.php
Commit message (Collapse)AuthorAgeFilesLines
...
* resourceloader: Convert mediawiki.Uri to package filesTimo Tijhof2020-02-241-3/+13
| | | | | | | | | | | This replaces the client-side compiler for 'mediawiki.template.regexp', with a simple PHP callback. The regexp temple compiler is not used anywhere after this and will be removed in a follow-up commit. Bug: T233676 Change-Id: I1baa1465d88293d03975cadf2efdd57283427722
* resourceloader: support tracking indirect module dependency paths via BagOStuffAaron Schulz2020-02-131-2/+3
| | | | | | | | | | | | This can be enabled via a configuration flag. Otherwise, SqlModuleDependencyStore will be used in order to keep using the module_deps table. Create a dependency store class, wrapping BagOStuff, that stores known module dependencies. Inject it into ResourceLoader and inject the path lists into ResourceLoaderModule directly and via callback. Bug: T113916 Change-Id: I6da55e78d5554e30e5df6b4bc45d84817f5bea15
* resourceloader: Separate style processing from style file loadingRoan Kattouw2020-02-121-27/+64
| | | | | | | | | | | | | | | | | | | ResourceLoaderFileModule::readStyleFile() both reads a style file from disk and processes it through LESS, CSSJanus and CSSMin. Factor out the processing part into ResourceLoaderFileModule::processStyle(), which takes a string of unprocessed CSS/LESS rather than a file. This is needed for future support for styles that don't come (directly) from a file, but are generated through packageFiles. Other changes: - Use a hash of the source instead of the file name in the cache keys for the LESS compilation output - Also prefix the cache key with 'resourceloader' while we're changing it anyway - LESS compilation no longer adds the source file itself as a dependency - Don't pass down $flip, just use $this>getFlip() Change-Id: I86e880d06af724f0fbae93e042c85e0395771912
* Merge "resourceloader: Allow packageFiles callbacks to return a file"jenkins-bot2020-01-201-9/+23
|\
| * resourceloader: Allow packageFiles callbacks to return a fileRoan Kattouw2019-12-171-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a callback for a virtual file returns a ResourceLoaderFilePath object, we will load that file from disk and use it in that file's place. This enables us to port modules that use languageScripts or skinScripts, by writing a virtual file callback that returns a ResourceLoaderFilePath pointing to different files depending on the language/skin. This also makes the base path parameters to the ResourceLoaderFilePath constructor optional. Callbacks would construct a ResourceLoaderFilePath with only one parameter (the file path, but no base paths), and the RL infrastructure ignores the object's base paths anyway, in favor of the module's base paths. Bug: T239371 Change-Id: I8e24f667b4e1944c20f3354a9f7382d5c486055e
* | resourceloader: Use FileContentsHasher batching in FileModule::getFileHashesTimo Tijhof2019-12-171-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of hashing each file separately, hash them in a batch. Previous research on this area of code has identified the suppressing and restoring of warnings to have a measurable cost, which is why this was optimised in 3621ad0f82f8b6b. However, we never really made use if it (aisde from the 2:1 change in that commit itself), because we always call it with a single item, turn it into an array, do the hash and then merge it again. Instead, we now let it handle a single module's set of files all at once. Given that this no longer exposes an array of hashes, also update the (private) signature of getFileHashes to reflect this. This means all file modules will have their version bumped during the next MediaWiki release. In general this happens for most releases and weekly branches already (due to localisation update, general maintenance, linting changes, and other internal changes). But, noting here for future reference as this might not be obvious from the diff. Change-Id: I4e141a0f5a5c1c1972e2ba33d4b7be6e64ed6ab6
* | resourceloader: Various optimisations in FileModule::getFileHashes()Timo Tijhof2019-12-171-18/+38
|/ | | | | | | | | | | | | | | | | | | | | * Use LanguageFallback::getAll directly instead of the deprecated wrapper Language::getFallbacksFor. * For the loop over package files, use foreach instead of the slower array_map. Also incorporate a simple simple isset() check in that foreach loop, instead of iterating the values a second time with array_filter. This also makes the check more explicit (we discard values that have 'filePath' unset or set to null), previously array_filter rejected any value that could indirectly cast to boolean false. * For the safeFileHash loop, also use foreach with assignments instead of the slower array_map. As a side-effect this now makes explicit that we don't preserve array keys (assignments use []= to push). This means we can remove the array_values() call, which previously performed yet another loop and transformation on our array. Bug: T233059 Change-Id: I3fe9f0a9ddcce8870ac02986193022a12ecc1606
* resourceloader: Use ConvertibleTimestamp and Logger directlyTimo Tijhof2019-12-041-47/+41
| | | | | | | | | | Avoid use of wfTimestamp and wfDebugLog global functions. Also simplify some of the error messages around processing of 'packageFiles' definitions and throw generic LogicException instead of MWException. Change-Id: I55ce1f107f53dfdfe673cbe4411b0a7c4e24b2ea
* extension.schema.v2: Fix schemas for 'packageFiles'Bartosz Dziewoński2019-10-241-2/+2
| | | | | | | | | | | | | | | | The PHP code handling 'packageFiles' looks like it only expects numeric arrays, and not associative arrays. Therefore in JSON the value for the 'packageFiles' key should be arrays and not objects. (And a special case of a string, handled the same as single-element array, is also accepted.) Individual items in the array can be not only strings, but also objects, describing data which is pulled from other sources than a file. * ResourceLoaderFileModule: Remove unused variable and tweak docs. Change-Id: I6c3d186de1877f73d4a4e3fec7d6d632a5d5fa83
* Merge "Fix new phan errors, part 7"jenkins-bot2019-10-211-0/+1
|\
| * Fix new phan errors, part 7Daimona Eaytoy2019-10-211-0/+1
| | | | | | | | | | Bug: T231636 Change-Id: Ia5e0abee7163c5a1abd0bb53b89603cc2e7a9b5c
* | resourceloader: Support passing extra arguments to packageFiles callbackAndrew Otto2019-10-211-5/+25
|/ | | | | | | | | | | | | | | Currently packageFiles callbacks take 2 parameters, $context and $config. This patch allows for specifying an extra parameter in the packageFiles definition that will be passed to the callback. Example: 'callback' => function ( $context, $config, $extra ) { ... }, 'callbackParam => [ 'this is val 1', 'this is val 2' ], The callback will be called with the usual $context and $config parameters, and the extra array is passed as third parameter. Bug: T233634 Change-Id: Ie11874665f4f9a557d4e394dcab3a972887e8126
* resourceloader: Add array type hintsFomafix2019-10-051-2/+2
| | | | Change-Id: I4844eae68e85adc46e52646ea066b459bbabdcce
* Merge "resourceloader: Add $context to static functions in ResourceLoader"jenkins-bot2019-09-271-1/+1
|\
| * resourceloader: Add $context to static functions in ResourceLoaderFomafix2019-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows to use the context in the functions. The following internal static functions from ResourceLoader get now a reference to the ResourceLoaderContext object: * makeLoaderImplementScript * makeLoaderStateScript * makeLoaderRegisterScript * makeLoaderSourcesScript ResouceLoader::encodeJsonForScript is duplicated to ResourceLoaderContext::encodeJson loading the debug mode from context. ResourceLoader::encodeJsonForScript is kept for other usages without context. The debug mode is loaded from $context->getDebug() instead of from ResourceLoader::inDebugMode(). This does not support to enable the debug mode by setting the cookie 'resourceLoaderDebug' or the configuration variable wgResourceLoaderDebug. Only the URL parameter debug=true enables the debug mode. This should be sufficient for the subsequent ResourceLoader requests. The tests don't need the global variable wgResourceLoaderDebug anymore. The initial ResourceLoader context in OutputPage still uses ResourceLoader::inDebugMode() with cookie and global configuration variable. This change adds the parameter $context with a ResourceLoaderContext object to ResourceLoaderModule::getDeprecationInformation and deprecates omitting the parameter. Ifa1a3bb56b731b83864022a358916c6aca5d7c10 updates this in extension ExtJSBase. Bug: T229311 Change-Id: I5341f18625209446a6d006f60244990f65530319
* | resourceloader: Add type hints for type ResourceLoaderContextFomafix2019-09-271-3/+3
| | | | | | | | Change-Id: I10fc4b9277f94fc495149fe0d0077b054090387b
* | resourceloader: Add Doxygen group and improve overall docsTimo Tijhof2019-09-141-3/+4
|/ | | | | | | | | | | | | | | | | | | * Add license header where missing. * Add missing `@since` (1.17 for most classes), except ResourceLoaderLessVarFileModule since 1.32 (1bc62c548c). * Remove duplicate file-level description for class-only files, merge with the class description instead. * Remove my own `@author` annotation from one file. * Mark core's own FileModule subclasses as `@internal`, except for the following which we support use of in extensions: ResourceLoaderLessVarFileModule, ResourceLoaderOOUIIconPackModule, and ResourceLoaderWikiModule. Change-Id: I336af2e4ccdbe2512594e8861b72628d24194e41
* docs: Fix Doxygen warning for invalid `@bar` in WANObjectCacheTimo Tijhof2019-09-051-3/+1
| | | | | | | Also change a `@private` tag to `@internal` in ResourceLoaderFileModule for consistency with other RL code. Change-Id: I8c3a5aa36b643083c0b6d2f3c8d623f344b7c0be
* docs: Fix typos for 'parameter' and 'perform'DannyS7122019-08-201-1/+1
| | | | | Bug: T201491 Change-Id: I37ed48907bf7c1a1d4ebab7b10b41a77623eba8a
* resourceloader: Consider 'packagesFiles' in FileModule's canBeStylesOnlyRoan Kattouw2019-08-071-0/+1
| | | | | | | A module with packageFiles should never be considered a styles-only module. Change-Id: I92f0d2f31656858d8dd00c73c4d9d7da329582a4
* resourceloader: Add Config parameter to packageFiles callbacksRoan Kattouw2019-07-181-3/+4
| | | | | | | | | | Callbacks used to generate the contents of virtual files in packageFiles modules only received a ResourceLoaderContext object. They could access the Config object through ResourceLoaderContext::getConfig(), but that method is deprecated. Pass the Config object as a second parameter to these callbacks, so that they don't have to use a deprecated method. Change-Id: Ia4666914e9b07f298ee5ae30ae8c70a3e83b0910
* Allow skins/extensions to define custom OOUI themesBartosz Dziewoński2019-07-101-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change follows I39cc2a735d9625c87bf4ede6f5fb0ec441d47dcc. docs/extension.schema.v1.json docs/extension.schema.v2.json includes/registration/ExtensionProcessor.php * The new extension attribute 'OOUIThemePaths' can be used to define custom OOUI themes. See I9187a63e509b601b8558ea82850fa828e5c8cc0a for an example usage. includes/resourceloader/ResourceLoaderOOUIModule.php * Add support for 'OOUIThemePaths'. * Defining 'images' is now optional. I figure custom themes are unlikely to have or need them. * Use ResourceLoaderFilePath objects to allow skin-/extension-defined OOUI module files to use skin/extension's base paths. This was previously used to support $wgResourceModuleSkinStyles, but only for 'skinStyles' - now ResourceLoaderFileModule needs to also handle it for 'skinScripts', and ResourceLoaderImageModule for 'images'). includes/resourceloader/ResourceLoaderFilePath.php * Add getters for local/remote base paths, for when we need to construct a new ResourceLoaderFilePath based on existing one. includes/resourceloader/ResourceLoaderFileModule.php includes/resourceloader/ResourceLoaderImageModule.php includes/resourceloader/ResourceLoaderOOUIImageModule.php * Add or improve handling of ResourceLoaderFilePaths: * Replace `(array)` casts with explicit array wrapping, to avoid casting objects into associative arrays. * Use getLocalPath() instead of string concatenation. tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php * Some basic checks for the above. Bug: T100896 Change-Id: I74362f0fc215b26f1f104ce7bdbbac1e106736ad
* resourceloader: Remove support for raw modulesTimo Tijhof2019-06-271-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Being a raw module means that when it is requested from load.php with "only=scripts" set, then the output is *not* wrapped in an 'mw.loader.implement' closure *and* there no 'mw.loader.state()' appendix. Instead, it is served "raw". Before 2018, the modules 'mediawiki' and 'jquery' were raw modules. They were needed before the client could define 'mw.loader.implement', and could never be valid dependencies. Module 'mediawiki' merged to 'startup', and 'jquery' became a regular module (T192623). Based on the architecture of modules being deliverable bundles, it doesn't make sense for there to ever be raw modules again. Anything that 'startup' needs should be bundled with it. Anything else is a regular module. On top of that, we never actually needed this feature because specifying the 'only=scripts' and 'raw=1' parameters does the same thing. The only special bit about marking modules (not requests) as "raw" was that it allowed the client to forget to specify "raw=1" and the server would automatically omit the 'mw.loader.state()' appendix based on whether the module is marked as raw. As of Ie4564ec8e26ad53f2, the two remaining use cases for raw responses now specify the 'raw=1' request parameter, and we can get rid of the "raw module" feature and all the complexity around it. == Startup module In the startup module there was an interesting use of isRaw() that has little to do with the above. The "ATTENTION" warning there applies to the startup module only, not raw modules in general. This is now fixed by explicitly checking for StartupModule. Above that warning, it talked about saving bytes, which was an optimisation given that "raw" modules don't communicate with mw.loader, they also don't need to be registered there because even if mw.loader would try to load them, the server would never inform mw.loader about the module having arrived. There are now no longer any such modules. Bug: T201483 Change-Id: I8839036e7b2b76919b6cd3aa42ccfde4d1247899
* resourceloader: Document which FileModule methods use a DBTimo Tijhof2019-06-191-0/+6
| | | | | | | | | | | | | Also, for the unit test, disable the two methods we use there that can get called. The unintended side-effects of these two methods was the only reason it used `@group Database`. Removing that makes the test a bit faster as well. Enforce this via MediaWikiServices for this suite to avoid an untracked dependency slipping back in in the future. Bug: T225730 Change-Id: I6c54466e9517d9899bc39f8f9bb946369c0a526d
* Use [...] instead of array(...) in PHP comments and documentationFomafix2019-06-171-1/+1
| | | | Change-Id: I0c83783051bf35fe785bc01644eeb2946902b6b2
* resourceloader: Support 'versionCallback' for computed package filesTimo Tijhof2019-06-141-10/+52
| | | | | | | | | | | | | | | | The use cases we've seen for using computed (or virtual) package files, involve expensive computations to expand and transform data for the client that we don't want to evaluate in full just to compute the module's version hash (e.g. in the StartupModule, where we need to do this for 1000s of modules). For such cases, the module can specify a 'versionCallback' of which the return value will be used to seed the module's version hash. The default remains the same as before, which is to use the full content to seed the version hash (via getDefinitionSummary). Bug: T223260 Change-Id: I76f573239e6bd429287e7adb33a92ffd5e260c20
* Remove unnecessary semi-colonsDerick Alangi2019-06-121-1/+1
| | | | Change-Id: I9eb65bdfbd3aa581effc14ead801b9e89b0359c3
* resourceloader: Fix variable spacings where need beJack Phoenix2019-04-061-1/+1
| | | | | | | This fix is to make sure resource loader code conforms with convension https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Spaces. Change-Id: I34c0a0addbf7c373fc3a64b644a3098bb485a3f4
* resourceloader: Reword and expand doc comment about FileModule "packageFiles"Aaron Schulz2019-03-121-4/+5
| | | | Change-Id: Id9d68205504ecbddea6ca248e108f368fdcac2d2
* resourceloader: Remove back compat for old packageFiles formatRoan Kattouw2019-02-221-9/+4
| | | | | | | Was introduced as a transitional measure in Ic566a1cd7efd075c3. Depends-On: I717f03caf9ea8266e6a4d2b6daf4c543c0815931 Change-Id: I6ae615ea38572042f8ba705338067b393827153a
* resourceloader: Change 'packageFiles' format to be JSON-compatibleRoan Kattouw2019-02-221-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The module definition format for 'packageFiles', as initially designed, mixes sequential and associative arrays. This works in PHP, but not in JSON. To make the format JSON compatible, use a 'name' key instead of using the key in the main array. Leave backwards compatibility in place so that extensions using the old format can be migrated. This will be removed in the next commit. Before: 'packageFiles' => [ 'script.js', 'script2.js', 'config.json' => [ 'config' => [ 'Foo', 'Bar' ] ], 'data.json' => [ 'callback' => function () { ... } ], ], After: 'packageFiles' => [ 'script.js', 'script2.js', [ 'name' => 'config.json', 'config' => [ 'Foo', 'Bar' ] ], [ 'name' => 'data.json', 'callback' => function () { ... } ], ], This can then be written in extension.json as: "packageFiles": [ "script.js", "script2.js", [ "name": "config.json", "config": [ "Foo", "Bar" ] ], [ "name": "data.json", "callback: [ "MyExtHooks", "getData" ] ] ] Change-Id: Ic566a1cd7efd075c380bc50ba0cc2c329a2041d7
* resourceloader: Require $context parameter for FileModule::readStyleFiles()Timo Tijhof2019-02-181-13/+4
| | | | | | | | | | Deprecated since MW 1.27. Also update ResourcesTest to use TestingAccessWrapper instead of long-form object reflection, and also apply it to its call for this method given its meant to be private. Change-Id: I9cc1af93730f632e4f8bf3a16d514a51ee73cb03
* ResourceLoader: Add support for packageFilesRoan Kattouw2019-02-051-5/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Package files are files that are part of a module, but are not immediately executed when the module executes. Instead, they are lazy-excecuted when require() is called on them. Package files can be scripts (JS) or data (JSON), and can be real files on the file system, or virtual files generated by a callback. Using virtual data files, server-side data and config variables can be bundled with a module. Support for file-based require() allows us to import npm modules into ResourceLoader more easily. The require function passed to each script execution context, which was previously a reference to the global mw.loader.require() function, is changed to one that is scoped to the module and the file being executed. This is needed to support relative paths: require( '../foo.js' ) can mean a different file depending on the path of the calling file. The results of require()ing each file (i.e. the value of module.exports after executing it) are stored, and calling require() on the same file a second time won't execute it again, but will return the stored value. Miscellaneous changes: - Add XmlJsCode::encodeObject(), which combines an associative array of XmlJsCode objects into one larger XmlJsCode object. This is needed for encoding the packageFiles parameter in mw.loader.implement() calls. Bug: T133462 Change-Id: I78cc86e626de0720397718cd2bed8ed279579112
* resourceloader: Remove wgResourceLoaderValidateStaticJS settingTimo Tijhof2018-08-201-9/+0
| | | | | | | | | | | | | | | | | | | | | | | Not used since 2011 (MediaWiki 1.18). In an early version of ResourceLoader, we ran JSMinPlus syntax validation on-demand on all served JavaScript content. This was identified as cause of slowdown and high memory use, and generally not considered as useful in production. The reason it was there originally was not for the purpose of validating static files, but for user-generated content. So in MediaWiki 1.18, the behaviour of wgResourceLoaderValidateJS was changed to only apply to user-generated content, and the rest was disabled behind wgResourceLoaderValidateStaticJS, which we then never use. Not even in development, given that we now have superior experience through ESLint, even within IDEs where supported. Follows-up 49d3d18033738 (r91914). Change-Id: Ie25109a4fb23ee93fed0db4af5db4b11fe9ffe7f
* resourceloader: Remove $wgResourceLoaderLESSVars supportTimo Tijhof2018-08-141-4/+1
| | | | | | | | | | | | | The use of global variables was deprecated in favour of ResourceLoaderModule::getLessVars() on a per-module basis. Also moved testLessFileCompilation case to the appropiate file as it covers ResourceLoaderFileModule.php, not ResourceLoader.php. Bug: T140804 Depends-On: Ib1b2808df2384473bfac47f53a5d25d7c9bbca2b Depends-On: I96047f69d01c4736306df2719267e6347daf556f Change-Id: If708087c85c80355c7e78f1768529b5f2e16ed07
* Fix PhanTypeMismatchDeclaredParamUmherirrender2018-07-071-8/+8
| | | | | | Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
* resourceloader: Add @covers for FileModuleTestTimo Tijhof2018-06-261-16/+16
| | | | | | | | | | | Add @covers for various helper methods used by public methods, where the helper methods actually contain most of the logic being tested in FileModuleTest. I've changed these methods from protected to private (confirmed no usage) to further pin down that their contract doesn't matter beyond making the public methods work. Change-Id: I2aef0d322b38bc3595e7d2c2339112b16fc66b8d
* Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-1/+1
| | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* resourceloader: Include global LESS variables in LESS cache keyAlexia E. Smith2018-05-251-2/+5
| | | | | | | | | | This prevents cache churn when the wiki-global LESS variables vary between wikis because the cache key is used as a "global" instead of db-local. This is good for the common case, but should still explicitly vary if the vars differ between wikis. Bug: T191937 Change-Id: If12fd07a7062792205384150d6f5fd9a83f996cc
* Remove self-explaining "section heading" comments from classesThiemo Mättig2017-12-281-3/+0
| | | | | | | | I can see that "parent::__construct" literally calls the parent constructor. I can see that stuff preceeded by the keyword "protected" is protected. I really (really) don't need comments explaining such. Change-Id: I7458e714976a6acd3ba6a7c93fdc27d03903df83
* resourceloader: Include lessVars in FileModule definition summaryTimo Tijhof2017-07-271-0/+6
| | | | | | | | | | | | | This already worked as expected for any module that uses the new enableModuleContentVersion model, but for the majority of file modules this is not yet the case for performance reasons. As such, make sure lessVars are included in our manual tracking. Include it conditionally to avoid changing the array for other modules, which would needlessly invalidate their cache. Bug: T171809 Change-Id: Ib250068e0ecfc29a09ca33c23bef901ee0482bf2
* resourceloader: Minor documentation and coding style improvementsTimo Tijhof2017-06-301-3/+5
| | | | | | Based on current non-voting codesniffer warnings. Change-Id: I34cbc31eda3eaa519a71fe2c04122859f2f15914
* resourceloader: Remove unused getPosition() codeTimo Tijhof2016-11-181-14/+0
| | | | | | Unused as of bc374082fa (T109837). Change-Id: I1d8f7109bbe49700f1824fdce0439e958e84f6fa
* Add 'noflip' option on RL modules to disable CSSJanusBrion Vibber2016-10-181-1/+5
| | | | | | | | | | | | | | | | | | | Should be useful for cases where we pull in an external library that already manages RTL flipping in its styles, and CSSJanus does the wrong thing without extra markup. Example: 'ext.tmh.video-js' => $baseExtensionResource + [ 'scripts' => 'resources/videojs/video.js', 'styles' => 'resources/videojs/video-js.css', 'noflip' => true, ... ], Bug: T148572 Bug: T148565 Change-Id: Icbad20d8a6e9a0d354ad159f5816f4fb67cc2775
* Clean up array() syntax from docs, part VIAmir Sarabadani2016-09-121-8/+8
| | | | Change-Id: Ib0eea494e2065c7ab356dc45fd174544a9c1c942
* Clean up array() syntax in docs, part IIIAmir Sarabadani2016-08-131-11/+11
| | | | | | Also fixing some typos here and there Change-Id: I29c29acf87f84ba9993ba75ebf2ad8091d981574
* resourceloader: Implement 'deprecated' option for FileModulejdlrobson2016-08-041-1/+4
| | | | | | | | | | | | ResourceLoader modules can now carry a 'deprecated' option which can be a boolean or an object with message key. This message or a default deprecation message will be show whenever that module is used in production. Note: This will not work in debug mode for ResourceLoaderFile modules and this is deemed acceptable for the time being. We can revisit later. Bug: T137772 Change-Id: Ib9ebd2d39a59fd41d8537e06884699f77b03580c
* resourceloader: Track state of page-style modulesTimo Tijhof2016-07-141-0/+22
| | | | | | | | | | | | | | | This allows dynamically loaded modules to depend on page-style modules without it causing the page-style module to be loaded a second time. * New method Module::getType() indicates whether a module is a page-style module or supposed to be dynamically loaded. * Emit warning from addModuleStyles() when given a module that is not a page-style module (to be enforced later) Bug: T92459 Bug: T87871 Change-Id: I8b6c6a10d965e73965f877c42e995d04202524f3
* resourceloader: Strip leading BOM when concatenating filesDerk-Jan Hartman2016-05-311-4/+20
| | | | | | | | We read files and concatenate their contents. Files may start with a BOM character. BOM characters are only allowed at the beginning of a file, not half way. Stripping it should be safe, since we already assume that everything is UTF-8. Change-Id: I14ad698a684e78976e873e9ae2c367475550a063
* CSSMin: Remove file-existance filter in getLocalFileReferences()Timo Tijhof2016-03-031-1/+1
| | | | | | | | | Follows-up 8f5cd11d82fa. The old getLocalFileReferences() method is no longer used anywhere. Remove it and rename getAllLocalFileReferences back to it. Change-Id: I864258aad128ba9b54464c7bc854543f2937f977