Skip to content

Commit

Permalink
LPS-84639 Add polyfill for Array.fill method
Browse files Browse the repository at this point in the history
  • Loading branch information
izaera committed Aug 21, 2018
1 parent 4423c56 commit d0f10c3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
@@ -1,6 +1,7 @@
import com.liferay.gradle.util.copy.StripPathSegmentsAction

configurations {
arrayFill
arrayFind
arrayFrom
fetch
Expand All @@ -10,6 +11,7 @@ configurations {
urlSearchParams
}

task buildArrayFill(type: Copy)
task buildArrayFind(type: Copy)
task buildArrayFrom(type: Copy)
task buildFetch(type: Copy)
Expand All @@ -18,6 +20,22 @@ task buildObjectEntries(type: Copy)
task buildObjectValues(type: Copy)
task buildUrlSearchParams(type: Copy)

buildArrayFill {
eachFile new StripPathSegmentsAction(5)

from {
zipTree(configurations.arrayFill.singleFile)
}

include "META-INF/resources/webjars/array.prototype.fill/1.0.2/index.js"
includeEmptyDirs = false
into "classes/META-INF/resources"

rename {
it.replace "index", "array.fill"
}
}

buildArrayFind {
eachFile new StripPathSegmentsAction(5)

Expand Down Expand Up @@ -127,6 +145,7 @@ buildUrlSearchParams {
}

classes {
dependsOn buildArrayFill
dependsOn buildArrayFind
dependsOn buildArrayFrom
dependsOn buildFetch
Expand All @@ -137,6 +156,8 @@ classes {
}

dependencies {
arrayFill group: "org.webjars.npm", name: "array.prototype.fill", transitive: false, version: "1.0.2"

arrayFind group: "org.webjars.bower", name: "Array.prototype.find", transitive: false, version: "1.0.0"

arrayFrom group: "org.webjars.npm", name: "mdn-polyfills", transitive: false, version: "5.8.0"
Expand Down
Expand Up @@ -71,8 +71,9 @@ public void register(DynamicIncludeRegistry dynamicIncludeRegistry) {
}

private static final String[] _FILE_NAMES = {
"array.find.js", "array.from.js", "fetch.js", "object.assign.js",
"object.entries.js", "object.values.js", "url.search.params.js"
"array.fill.js", "array.find.js", "array.from.js", "fetch.js",
"object.assign.js", "object.entries.js", "object.values.js",
"url.search.params.js"
};

@Reference
Expand Down

0 comments on commit d0f10c3

Please sign in to comment.