content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Text | Text | remove extra class [ci skip] | 03043ab07ce95a71b57c618f8bb7d0f023c0e040 | <ide><path>guides/source/6_1_release_notes.md
<ide> Please refer to the [Changelog][active-record] for detailed changes.
<ide>
<ide> * Named scope chain does no longer leak scope to class level querying methods.
<ide>
<del> class class User < ActiveRecord::Base
<add> class User < ActiveRecord::Base
<ide> scope :david, -> { User.where(name: "David") }
<ide> end
<ide> | 1 |
Python | Python | redact conn secrets in webserver logs | 2a59de3e558e3b60caad876dee8fa4b43a7a17cf | <ide><path>airflow/hooks/base.py
<ide>
<ide> from airflow.typing_compat import Protocol
<ide> from airflow.utils.log.logging_mixin import LoggingMixin
<add>from airflow.utils.log.secrets_masker import redact
<ide>
<ide> if TYPE_CHECKING:
<ide> from airflow.models.connection import Connection # Avoid circular imports.
<ide> def get_connection(cls, conn_id: str) -> "Connection":
<ide> conn.port,
<ide> conn.schema,
<ide> conn.login,
<del> conn.password,
<del> conn.extra_dejson,
<add> redact(conn.password),
<add> redact(conn.extra_dejson),
<ide> )
<ide> return conn
<ide> | 1 |
Java | Java | remove testgroup.ci enum constant | 01fb35bd2d81444fff008172bf58efa1912402af | <ide><path>spring-core/src/test/java/org/springframework/core/io/ResourceTests.java
<ide> import java.io.IOException;
<ide> import java.io.InputStream;
<ide> import java.io.InputStreamReader;
<add>import java.net.HttpURLConnection;
<add>import java.net.URL;
<ide> import java.nio.ByteBuffer;
<ide> import java.nio.channels.ReadableByteChannel;
<ide> import java.nio.file.Path;
<ide>
<ide> import org.junit.jupiter.api.Test;
<ide>
<del>import org.springframework.tests.EnabledForTestGroups;
<ide> import org.springframework.util.FileCopyUtils;
<ide>
<ide> import static org.assertj.core.api.Assertions.assertThat;
<ide> import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
<del>import static org.springframework.tests.TestGroup.CI;
<add>import static org.junit.jupiter.api.Assumptions.assumeTrue;
<ide>
<ide> /**
<ide> * Unit tests for various {@link Resource} implementations.
<ide> void urlResourceWithRelativePath() throws IOException {
<ide> }
<ide>
<ide> @Test
<del> @EnabledForTestGroups(CI)
<del> void testNonFileResourceExists() throws Exception {
<del> Resource resource = new UrlResource("https://spring.io/");
<add> void nonFileResourceExists() throws Exception {
<add> URL url = new URL("https://spring.io/");
<add>
<add> // Abort if spring.io is not reachable.
<add> assumeTrue(urlIsReachable(url));
<add>
<add> Resource resource = new UrlResource(url);
<ide> assertThat(resource.exists()).isTrue();
<ide> }
<ide>
<add> private boolean urlIsReachable(URL url) {
<add> try {
<add> HttpURLConnection connection = (HttpURLConnection) url.openConnection();
<add> connection.setRequestMethod("HEAD");
<add> connection.setReadTimeout(5_000);
<add> return connection.getResponseCode() == HttpURLConnection.HTTP_OK;
<add> }
<add> catch (Exception ex) {
<add> return false;
<add> }
<add> }
<add>
<ide> @Test
<ide> void abstractResourceExceptions() throws Exception {
<ide> final String name = "test-resource";
<ide><path>spring-core/src/test/java/org/springframework/tests/AssumeTests.java
<ide> import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
<ide> import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
<ide> import static org.springframework.tests.Assume.TEST_GROUPS_SYSTEM_PROPERTY;
<del>import static org.springframework.tests.TestGroup.CI;
<ide> import static org.springframework.tests.TestGroup.LONG_RUNNING;
<ide> import static org.springframework.tests.TestGroup.PERFORMANCE;
<ide>
<ide> void assumeGroupWithNoActiveTestGroups() {
<ide> @Test
<ide> @SuppressWarnings("deprecation")
<ide> void assumeGroupWithNoMatchingActiveTestGroup() {
<del> setTestGroups(PERFORMANCE, CI);
<add> setTestGroups(PERFORMANCE);
<ide> assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> Assume.group(LONG_RUNNING));
<ide> }
<ide>
<ide> private void assertBogusActiveTestGroupBehavior(String testGroups) {
<ide> //
<ide> // java.lang.IllegalStateException: Failed to parse 'testGroups' system property:
<ide> // Unable to find test group 'bogus' when parsing testGroups value: 'all-bogus'.
<del> // Available groups include: [LONG_RUNNING,PERFORMANCE,CI]
<add> // Available groups include: [LONG_RUNNING,PERFORMANCE]
<ide>
<ide> setTestGroups(testGroups);
<ide> assertThatIllegalStateException()
<ide> private void assertBogusActiveTestGroupBehavior(String testGroups) {
<ide> .satisfies(ex ->
<ide> assertThat(ex.getCause().getMessage()).isEqualTo(
<ide> "Unable to find test group 'bogus' when parsing testGroups value: '" + testGroups +
<del> "'. Available groups include: [LONG_RUNNING,PERFORMANCE,CI]"));
<add> "'. Available groups include: [LONG_RUNNING,PERFORMANCE]"));
<ide> }
<ide>
<ide> private void setTestGroups(TestGroup... testGroups) {
<ide><path>spring-core/src/test/java/org/springframework/tests/TestGroup.java
<ide> public enum TestGroup {
<ide> * {@code StopWatch}, etc. should be considered a candidate as their successful
<ide> * execution is likely to be based on events occurring within a given time window.
<ide> */
<del> PERFORMANCE,
<del>
<del> /**
<del> * Tests that should only be run on the continuous integration server.
<del> */
<del> CI;
<add> PERFORMANCE;
<ide>
<ide>
<ide> /**
<ide> static Set<TestGroup> loadTestGroups() {
<ide> "' system property: " + ex.getMessage(), ex);
<ide> }
<ide> }
<add>
<ide> /**
<ide> * Parse the specified comma separated string of groups.
<ide> * @param value the comma separated string of groups
<ide><path>spring-core/src/test/java/org/springframework/tests/TestGroupTests.java
<ide> void parseMissing() {
<ide> .isThrownBy(() -> TestGroup.parse("performance, missing"))
<ide> .withMessageContaining("Unable to find test group 'missing' when parsing " +
<ide> "testGroups value: 'performance, missing'. Available groups include: " +
<del> "[LONG_RUNNING,PERFORMANCE,CI]");
<add> "[LONG_RUNNING,PERFORMANCE]");
<ide> }
<ide>
<ide> @Test
<ide> void parseAllExceptMissing() {
<ide> .isThrownBy(() -> TestGroup.parse("all-missing"))
<ide> .withMessageContaining("Unable to find test group 'missing' when parsing " +
<ide> "testGroups value: 'all-missing'. Available groups include: " +
<del> "[LONG_RUNNING,PERFORMANCE,CI]");
<add> "[LONG_RUNNING,PERFORMANCE]");
<ide> }
<ide>
<ide> } | 4 |
PHP | PHP | toughen callable usage | 3b63d72447ffbc15eb8feebaf8a5361b0da54c0f | <ide><path>lib/Cake/Model/Datasource/Database/Query.php
<ide> public function execute() {
<ide>
<ide> $query = $this->_transformQuery();
<ide> $statement = $this->_connection->prepare($query->sql(false));
<del> $query->_bindParams($statement);
<add> $query->_bindStatement($statement);
<ide> $statement->execute();
<ide>
<ide> return $query->_decorateResults($statement);
<ide> public function execute() {
<ide> * add, remove or alter any query part or internal expression to make it
<ide> * executable in the target platform.
<ide> *
<del> * Resulting query may have placeholders that will be replaced with the actual
<add> * The resulting query may have placeholders that will be replaced with the actual
<ide> * values when the query is executed, hence it is most suitable to use with
<ide> * prepared statements.
<ide> *
<ide> * @param boolean $transform Whether to let the connection transform the query
<del> * to the specific dialect or not
<add> * to the specific dialect or not
<ide> * @return string
<ide> */
<ide> public function sql($transform = true) {
<ide> public function traverse(callable $visitor) {
<ide> protected function _traverseSelect(callable $visitor) {
<ide> $parts = ['select', 'from', 'join', 'where', 'group', 'having', 'order', 'limit', 'offset', 'union'];
<ide> foreach ($parts as $name) {
<del> $visitor($this->_parts[$name], $name);
<add> call_user_func($visitor, $this->_parts[$name], $name);
<ide> }
<ide> }
<ide>
<ide> protected function _traverseSelect(callable $visitor) {
<ide> protected function _traverseDelete(callable $visitor) {
<ide> $parts = ['delete', 'from', 'where'];
<ide> foreach ($parts as $name) {
<del> $visitor($this->_parts[$name], $name);
<add> call_user_func($visitor, $this->_parts[$name], $name);
<ide> }
<ide> }
<ide>
<ide> protected function _traverseDelete(callable $visitor) {
<ide> protected function _traverseUpdate(callable $visitor) {
<ide> $parts = ['update', 'set', 'where'];
<ide> foreach ($parts as $name) {
<del> $visitor($this->_parts[$name], $name);
<add> call_user_func($visitor, $this->_parts[$name], $name);
<ide> }
<ide> }
<ide>
<ide> protected function _traverseUpdate(callable $visitor) {
<ide> protected function _traverseInsert(callable $visitor) {
<ide> $parts = ['insert', 'values'];
<ide> foreach ($parts as $name) {
<del> $visitor($this->_parts[$name], $name);
<add> call_user_func($visitor, $this->_parts[$name], $name);
<ide> }
<ide> }
<ide>
<ide> public function select($fields = [], $overwrite = false) {
<ide> }
<ide>
<ide> if (is_callable($fields)) {
<del> $fields = $fields($this);
<add> $fields = call_user_func($fields, $this);
<ide> }
<ide>
<ide> if (!is_array($fields)) {
<ide> protected function _conjugate($part, $append, $conjunction, $types) {
<ide> $expression = $this->_parts[$part] ?: $this->newExpr();
<ide>
<ide> if (is_callable($append)) {
<del> $append = $append($this->newExpr(), $this);
<add> $append = call_user_func($append, $this->newExpr(), $this);
<ide> }
<ide>
<ide> if ($expression->type() === $conjunction) {
<ide> protected function _conjugate($part, $append, $conjunction, $types) {
<ide> * @param Cake\Model\Datasource\Database\Statement $statement
<ide> * @return void
<ide> */
<del> protected function _bindParams($statement) {
<add> protected function _bindStatement($statement) {
<ide> $binder = function($expression) use ($statement) {
<ide> $params = $types = [];
<ide>
<ide> if ($expression instanceof Comparison) {
<ide> if ($expression->getValue() instanceof self) {
<del> $expression->getValue()->_bindParams($statement);
<add> $expression->getValue()->_bindStatement($statement);
<ide> }
<ide> }
<ide>
<ide> protected function _bindParams($statement) {
<ide>
<ide> /**
<ide> * This function works similar to the traverse() function, with the difference
<del> * that it does a full depth traversal of all expression tree. This will execute
<add> * that it does a full depth traversal of the entire expression tree. This will execute
<ide> * the provided callback function for each ExpressionInterface object that is
<ide> * stored inside this query at any nesting depth in any part of the query.
<ide> *
<ide> * Callback will receive as first parameter the currently visited expression.
<ide> *
<ide> * @param callable $callback the function to be executed for each ExpressionInterface
<del> * found inside this query.
<add> * found inside this query.
<ide> * @return Query
<ide> */
<ide> public function traverseExpressions(callable $callback) {
<ide> $visitor = function($expression) use (&$visitor, $callback) {
<ide> if (is_array($expression)) {
<ide> foreach ($expression as $e) {
<del> $visitor($e);
<add> call_user_func($visitor, $e);
<ide> }
<ide> return;
<ide> }
<ide> public function traverseExpressions(callable $callback) {
<ide> $expression->traverse($visitor);
<ide>
<ide> if (!($expression instanceof self)) {
<del> $callback($expression);
<add> call_user_func($callback, $expression);
<ide> }
<ide> }
<ide> }; | 1 |
PHP | PHP | use correct syntax and move postgres grammar | dc263d4fe2580306ab35ecf164158863bc3d6958 | <ide><path>src/Illuminate/Database/Query/Grammars/Grammar.php
<ide> protected function compileAggregate(Builder $query, $aggregate)
<ide> // we need to prepend "distinct" onto the column name so that the query takes
<ide> // it into account when it performs the aggregating operations on the data.
<ide> if (is_array($query->distinct)) {
<del> $column = 'distinct ('.$this->columnize($query->distinct).')';
<add> $column = 'distinct '.$this->columnize($query->distinct).'';
<ide> } elseif ($query->distinct && $column !== '*') {
<ide> $column = 'distinct '.$column;
<ide> }
<ide> protected function compileColumns(Builder $query, $columns)
<ide> return;
<ide> }
<ide>
<del> if (is_array($query->distinct)) {
<del> $select = 'select distinct ('.$this->columnize($query->distinct).'), ';
<del> } elseif ($query->distinct) {
<add> if ($query->distinct) {
<ide> $select = 'select distinct ';
<ide> } else {
<ide> $select = 'select ';
<ide><path>src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
<ide> public function compileSelect(Builder $query)
<ide> return $sql;
<ide> }
<ide>
<add> /**
<add> * Compile the "select *" portion of the query.
<add> *
<add> * @param \Illuminate\Database\Query\Builder $query
<add> * @param array $columns
<add> * @return string|null
<add> */
<add> protected function compileColumns(Builder $query, $columns)
<add> {
<add> // If the query is actually performing an aggregating select, we will let that
<add> // compiler handle the building of the select clauses, as it will need some
<add> // more syntax that is best handled by that function to keep things neat.
<add> if (! is_null($query->aggregate)) {
<add> return;
<add> }
<add>
<add> if (is_array($query->distinct)) {
<add> $select = 'select distinct on ('.$this->columnize($query->distinct).') ';
<add> } elseif ($query->distinct) {
<add> $select = 'select distinct ';
<add> } else {
<add> $select = 'select ';
<add> }
<add>
<add> return $select.$this->columnize($columns);
<add> }
<add>
<ide> /**
<ide> * Compile a single union statement.
<ide> *
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testBasicSelectDistinct()
<ide> $this->assertEquals('select distinct "foo", "bar" from "users"', $builder->toSql());
<ide> }
<ide>
<del> public function testBasicSelectDistinctWithColumns()
<add> public function testBasicSelectDistinctOnColumns()
<ide> {
<ide> $builder = $this->getBuilder();
<ide> $builder->distinct('foo')->select('foo', 'bar')->from('users');
<del> $this->assertEquals('select distinct ("foo"), "foo", "bar" from "users"', $builder->toSql());
<add> $this->assertEquals('select distinct "foo", "bar" from "users"', $builder->toSql());
<add>
<add> $builder = $this->getPostgresBuilder();
<add> $builder->distinct('foo')->select('foo', 'bar')->from('users');
<add> $this->assertEquals('select distinct on ("foo") "foo", "bar" from "users"', $builder->toSql());
<ide> }
<ide>
<ide> public function testBasicAlias() | 3 |
Java | Java | revert "no need to allocate a new head node." | 2f7031e780404c8f5a355809dd309885f27ba483 | <ide><path>src/main/java/rx/internal/operators/OperatorReplay.java
<ide> final void removeFirst() {
<ide> size--;
<ide> // can't just move the head because it would retain the very first value
<ide> // can't null out the head's value because of late replayers would see null
<del> setFirst(next);
<add> setFirst(next.get());
<ide> }
<del> /* test */ final void removeSome(int n) {
<add> final void removeSome(int n) {
<ide> Node head = get();
<ide> while (n > 0) {
<ide> head = head.get();
<ide> n--;
<ide> size--;
<ide> }
<ide>
<del> setFirst(head);
<add> setFirst(head.get());
<ide> }
<ide> /**
<ide> * Arranges the given node is the new head from now on.
<ide> * @param n
<ide> */
<ide> final void setFirst(Node n) {
<del> set(n);
<add> Node newHead = new Node(null);
<add> newHead.lazySet(n);
<add> if (n == null) {
<add> tail = newHead;
<add> }
<add> set(newHead);
<ide> }
<ide>
<ide> @Override
<ide> Object leaveTransform(Object value) {
<ide> void truncate() {
<ide> long timeLimit = scheduler.now() - maxAgeInMillis;
<ide>
<del> Node prev = get();
<del> Node next = prev.get();
<add> Node head = get();
<add> Node next = head.get();
<ide>
<ide> int e = 0;
<ide> for (;;) {
<ide> if (next != null) {
<ide> if (size > limit) {
<ide> e++;
<ide> size--;
<del> prev = next;
<ide> next = next.get();
<ide> } else {
<ide> Timestamped<?> v = (Timestamped<?>)next.value;
<ide> if (v.getTimestampMillis() <= timeLimit) {
<ide> e++;
<ide> size--;
<del> prev = next;
<ide> next = next.get();
<ide> } else {
<ide> break;
<ide> void truncate() {
<ide> }
<ide> }
<ide> if (e != 0) {
<del> setFirst(prev);
<add> setFirst(next);
<ide> }
<ide> }
<ide> @Override
<ide> void truncateFinal() {
<ide> long timeLimit = scheduler.now() - maxAgeInMillis;
<ide>
<del> Node prev = get();
<del> Node next = prev.get();
<add> Node head = get();
<add> Node next = head.get();
<ide>
<ide> int e = 0;
<ide> for (;;) {
<ide> void truncateFinal() {
<ide> if (v.getTimestampMillis() <= timeLimit) {
<ide> e++;
<ide> size--;
<del> prev = next;
<ide> next = next.get();
<ide> } else {
<ide> break;
<ide> void truncateFinal() {
<ide> }
<ide> }
<ide> if (e != 0) {
<del> setFirst(prev);
<add> setFirst(next);
<ide> }
<ide> }
<ide> } | 1 |
Ruby | Ruby | remove unused hashcaching | c70fd5df7fd8af3a50539d6edf9c3453d2f892e8 | <ide><path>activesupport/lib/active_support/caching_tools.rb
<del>module ActiveSupport
<del> module CachingTools #:nodoc:
<del>
<del> # Provide shortcuts to simply the creation of nested default hashes. This
<del> # pattern is useful, common practice, and unsightly when done manually.
<del> module HashCaching
<del> # Dynamically create a nested hash structure used to cache calls to +method_name+
<del> # The cache method is named +#{method_name}_cache+ unless :as => :alternate_name
<del> # is given.
<del> #
<del> # The hash structure is created using nested Hash.new. For example:
<del> #
<del> # def slow_method(a, b) a ** b end
<del> #
<del> # can be cached using hash_cache :slow_method, which will define the method
<del> # slow_method_cache. We can then find the result of a ** b using:
<del> #
<del> # slow_method_cache[a][b]
<del> #
<del> # The hash structure returned by slow_method_cache would look like this:
<del> #
<del> # Hash.new do |as, a|
<del> # as[a] = Hash.new do |bs, b|
<del> # bs[b] = slow_method(a, b)
<del> # end
<del> # end
<del> #
<del> # The generated code is actually compressed onto a single line to maintain
<del> # sensible backtrace signatures.
<del> #
<del> def hash_cache(method_name, options = {})
<del> selector = options[:as] || "#{method_name}_cache"
<del> method = self.instance_method(method_name)
<del>
<del> args = []
<del> code = "def #{selector}(); @#{selector} ||= "
<del>
<del> (1..method.arity).each do |n|
<del> args << "v#{n}"
<del> code << "Hash.new {|h#{n}, v#{n}| h#{n}[v#{n}] = "
<del> end
<del>
<del> # Add the method call with arguments, followed by closing braces and end.
<del> code << "#{method_name}(#{args * ', '}) #{'}' * method.arity} end"
<del>
<del> # Extract the line number information from the caller. Exceptions arising
<del> # in the generated code should point to the +hash_cache :...+ line.
<del> if caller[0] && /^(.*):(\d+)$/ =~ caller[0]
<del> file, line_number = $1, $2.to_i
<del> else # We can't give good trackback info; fallback to this line:
<del> file, line_number = __FILE__, __LINE__
<del> end
<del>
<del> # We use eval rather than building proc's because it allows us to avoid
<del> # linking the Hash's to this method's binding. Experience has shown that
<del> # doing so can cause obtuse memory leaks.
<del> class_eval code, file, line_number
<del> end
<del> end
<del>
<del> end
<del>end
<ide><path>activesupport/test/caching_tools_test.rb
<del>require File.dirname(__FILE__) + '/abstract_unit'
<del>require File.join(File.dirname(File.dirname(__FILE__)), 'lib/active_support/caching_tools.rb')
<del>
<del>class HashCachingTests < Test::Unit::TestCase
<del> def cached(&proc)
<del> return @cached if defined?(@cached)
<del>
<del> @cached_class = Class.new(&proc)
<del> @cached_class.class_eval do
<del> extend ActiveSupport::CachingTools::HashCaching
<del> hash_cache :slow_method
<del> end
<del> @cached = @cached_class.new
<del> end
<del>
<del> def test_cache_access_should_call_method
<del> cached do
<del> def slow_method(a) raise "I should be here: #{a}"; end
<del> end
<del> assert_raises(RuntimeError) { cached.slow_method_cache[1] }
<del> end
<del>
<del> def test_cache_access_should_actually_cache
<del> cached do
<del> def slow_method(a)
<del> (@x ||= [])
<del> if @x.include?(a) then raise "Called twice for #{a}!"
<del> else
<del> @x << a
<del> a + 1
<del> end
<del> end
<del> end
<del> assert_equal 11, cached.slow_method_cache[10]
<del> assert_equal 12, cached.slow_method_cache[11]
<del> assert_equal 11, cached.slow_method_cache[10]
<del> assert_equal 12, cached.slow_method_cache[11]
<del> end
<del>
<del> def test_cache_should_be_clearable
<del> cached do
<del> def slow_method(a)
<del> @x ||= 0
<del> @x += 1
<del> end
<del> end
<del> assert_equal 1, cached.slow_method_cache[:a]
<del> assert_equal 2, cached.slow_method_cache[:b]
<del> assert_equal 3, cached.slow_method_cache[:c]
<del>
<del> assert_equal 1, cached.slow_method_cache[:a]
<del> assert_equal 2, cached.slow_method_cache[:b]
<del> assert_equal 3, cached.slow_method_cache[:c]
<del>
<del> cached.slow_method_cache.clear
<del>
<del> assert_equal 4, cached.slow_method_cache[:a]
<del> assert_equal 5, cached.slow_method_cache[:b]
<del> assert_equal 6, cached.slow_method_cache[:c]
<del> end
<del>
<del> def test_deep_caches_should_work_too
<del> cached do
<del> def slow_method(a, b, c)
<del> a + b + c
<del> end
<del> end
<del> assert_equal 3, cached.slow_method_cache[1][1][1]
<del> assert_equal 7, cached.slow_method_cache[1][2][4]
<del> assert_equal 7, cached.slow_method_cache[1][2][4]
<del> assert_equal 7, cached.slow_method_cache[4][2][1]
<del>
<del> assert_equal({
<del> 1 => {1 => {1 => 3}, 2 => {4 => 7}},
<del> 4 => {2 => {1 => 7}}},
<del> cached.slow_method_cache
<del> )
<del> end
<del>end | 2 |
Go | Go | fix deadlock when more than 1 plugin is installed | 42360d164b9f25fb4b150ef066fcf57fa39559a7 | <ide><path>plugin/manager.go
<ide> func (pm *Manager) init() error {
<ide> }
<ide> }
<ide> }(p)
<del> group.Wait()
<ide> }
<add> group.Wait()
<ide> return pm.save()
<ide> }
<ide> | 1 |
Python | Python | remove `normed=` keyword argument from histogroms | 2215054472616df563faa4613734426c790d4217 | <ide><path>numpy/lib/histograms.py
<ide> def histogram_bin_edges(a, bins=10, range=None, weights=None):
<ide>
<ide>
<ide> def _histogram_dispatcher(
<del> a, bins=None, range=None, normed=None, weights=None, density=None):
<add> a, bins=None, range=None, density=None, weights=None):
<ide> return (a, bins, weights)
<ide>
<ide>
<ide> @array_function_dispatch(_histogram_dispatcher)
<del>def histogram(a, bins=10, range=None, normed=None, weights=None,
<del> density=None):
<add>def histogram(a, bins=10, range=None, density=None, weights=None):
<ide> r"""
<ide> Compute the histogram of a dataset.
<ide>
<ide> def histogram(a, bins=10, range=None, normed=None, weights=None,
<ide> computation as well. While bin width is computed to be optimal
<ide> based on the actual data within `range`, the bin count will fill
<ide> the entire range including portions containing no data.
<del> normed : bool, optional
<del>
<del> .. deprecated:: 1.6.0
<del>
<del> This is equivalent to the `density` argument, but produces incorrect
<del> results for unequal bin widths. It should not be used.
<del>
<del> .. versionchanged:: 1.15.0
<del> DeprecationWarnings are actually emitted.
<del>
<ide> weights : array_like, optional
<ide> An array of weights, of the same shape as `a`. Each value in
<ide> `a` only contributes its associated weight towards the bin count
<ide> def histogram(a, bins=10, range=None, normed=None, weights=None,
<ide> histogram values will not be equal to 1 unless bins of unity
<ide> width are chosen; it is not a probability *mass* function.
<ide>
<del> Overrides the ``normed`` keyword if given.
<del>
<ide> Returns
<ide> -------
<ide> hist : array
<ide> def histogram(a, bins=10, range=None, normed=None, weights=None,
<ide>
<ide> n = np.diff(cum_n)
<ide>
<del> # density overrides the normed keyword
<del> if density is not None:
<del> if normed is not None:
<del> # 2018-06-13, numpy 1.15.0 (this was not noisily deprecated in 1.6)
<del> warnings.warn(
<del> "The normed argument is ignored when density is provided. "
<del> "In future passing both will result in an error.",
<del> DeprecationWarning, stacklevel=3)
<del> normed = None
<del>
<ide> if density:
<ide> db = np.array(np.diff(bin_edges), float)
<ide> return n/db/n.sum(), bin_edges
<del> elif normed:
<del> # 2018-06-13, numpy 1.15.0 (this was not noisily deprecated in 1.6)
<del> warnings.warn(
<del> "Passing `normed=True` on non-uniform bins has always been "
<del> "broken, and computes neither the probability density "
<del> "function nor the probability mass function. "
<del> "The result is only correct if the bins are uniform, when "
<del> "density=True will produce the same result anyway. "
<del> "The argument will be removed in a future version of "
<del> "numpy.",
<del> np.VisibleDeprecationWarning, stacklevel=3)
<del>
<del> # this normalization is incorrect, but
<del> db = np.array(np.diff(bin_edges), float)
<del> return n/(n*db).sum(), bin_edges
<del> else:
<del> if normed is not None:
<del> # 2018-06-13, numpy 1.15.0 (this was not noisily deprecated in 1.6)
<del> warnings.warn(
<del> "Passing normed=False is deprecated, and has no effect. "
<del> "Consider passing the density argument instead.",
<del> DeprecationWarning, stacklevel=3)
<del> return n, bin_edges
<add>
<add> return n, bin_edges
<ide>
<ide>
<del>def _histogramdd_dispatcher(sample, bins=None, range=None, normed=None,
<del> weights=None, density=None):
<add>def _histogramdd_dispatcher(sample, bins=None, range=None, density=None,
<add> weights=None):
<ide> if hasattr(sample, 'shape'): # same condition as used in histogramdd
<ide> yield sample
<ide> else:
<ide> def _histogramdd_dispatcher(sample, bins=None, range=None, normed=None,
<ide>
<ide>
<ide> @array_function_dispatch(_histogramdd_dispatcher)
<del>def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
<del> density=None):
<add>def histogramdd(sample, bins=10, range=None, density=None, weights=None):
<ide> """
<ide> Compute the multidimensional histogram of some data.
<ide>
<ide> def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
<ide> If False, the default, returns the number of samples in each bin.
<ide> If True, returns the probability *density* function at the bin,
<ide> ``bin_count / sample_count / bin_volume``.
<del> normed : bool, optional
<del> An alias for the density argument that behaves identically. To avoid
<del> confusion with the broken normed argument to `histogram`, `density`
<del> should be preferred.
<ide> weights : (N,) array_like, optional
<ide> An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`.
<del> Weights are normalized to 1 if normed is True. If normed is False,
<add> Weights are normalized to 1 if density is True. If density is False,
<ide> the values of the returned histogram are equal to the sum of the
<ide> weights belonging to the samples falling into each bin.
<ide>
<ide> Returns
<ide> -------
<ide> H : ndarray
<del> The multidimensional histogram of sample x. See normed and weights
<add> The multidimensional histogram of sample x. See density and weights
<ide> for the different possible semantics.
<ide> edges : list
<ide> A list of D arrays describing the bin edges for each dimension.
<ide> def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
<ide> core = D*(slice(1, -1),)
<ide> hist = hist[core]
<ide>
<del> # handle the aliasing normed argument
<del> if normed is None:
<del> if density is None:
<del> density = False
<del> elif density is None:
<del> # an explicit normed argument was passed, alias it to the new name
<del> density = normed
<del> else:
<del> raise TypeError("Cannot specify both 'normed' and 'density'")
<del>
<ide> if density:
<ide> # calculate the probability density function
<ide> s = hist.sum()
<ide><path>numpy/lib/tests/test_histograms.py
<ide> def test_one_bin(self):
<ide> assert_equal(h, np.array([2]))
<ide> assert_allclose(e, np.array([1., 2.]))
<ide>
<del> def test_normed(self):
<del> sup = suppress_warnings()
<del> with sup:
<del> rec = sup.record(np.VisibleDeprecationWarning, '.*normed.*')
<del> # Check that the integral of the density equals 1.
<del> n = 100
<del> v = np.random.rand(n)
<del> a, b = histogram(v, normed=True)
<del> area = np.sum(a * np.diff(b))
<del> assert_almost_equal(area, 1)
<del> assert_equal(len(rec), 1)
<del>
<del> sup = suppress_warnings()
<del> with sup:
<del> rec = sup.record(np.VisibleDeprecationWarning, '.*normed.*')
<del> # Check with non-constant bin widths (buggy but backwards
<del> # compatible)
<del> v = np.arange(10)
<del> bins = [0, 1, 5, 9, 10]
<del> a, b = histogram(v, bins, normed=True)
<del> area = np.sum(a * np.diff(b))
<del> assert_almost_equal(area, 1)
<del> assert_equal(len(rec), 1)
<del>
<ide> def test_density(self):
<ide> # Check that the integral of the density equals 1.
<ide> n = 100
<ide> def test_density_non_uniform_1d(self):
<ide> hist_dd, edges_dd = histogramdd((v,), (bins,), density=True)
<ide> assert_equal(hist, hist_dd)
<ide> assert_equal(edges, edges_dd[0])
<del>
<del> def test_density_via_normed(self):
<del> # normed should simply alias to density argument
<del> v = np.arange(10)
<del> bins = np.array([0, 1, 3, 6, 10])
<del> hist, edges = histogram(v, bins, density=True)
<del> hist_dd, edges_dd = histogramdd((v,), (bins,), normed=True)
<del> assert_equal(hist, hist_dd)
<del> assert_equal(edges, edges_dd[0])
<del>
<del> def test_density_normed_redundancy(self):
<del> v = np.arange(10)
<del> bins = np.array([0, 1, 3, 6, 10])
<del> with assert_raises_regex(TypeError, "Cannot specify both"):
<del> hist_dd, edges_dd = histogramdd((v,), (bins,),
<del> density=True,
<del> normed=True)
<ide><path>numpy/lib/twodim_base.py
<ide> def vander(x, N=None, increasing=False):
<ide> return v
<ide>
<ide>
<del>def _histogram2d_dispatcher(x, y, bins=None, range=None, normed=None,
<del> weights=None, density=None):
<add>def _histogram2d_dispatcher(x, y, bins=None, range=None, density=None,
<add> weights=None):
<ide> yield x
<ide> yield y
<ide>
<ide> def _histogram2d_dispatcher(x, y, bins=None, range=None, normed=None,
<ide>
<ide>
<ide> @array_function_dispatch(_histogram2d_dispatcher)
<del>def histogram2d(x, y, bins=10, range=None, normed=None, weights=None,
<del> density=None):
<add>def histogram2d(x, y, bins=10, range=None, density=None, weights=None):
<ide> """
<ide> Compute the bi-dimensional histogram of two data samples.
<ide>
<ide> def histogram2d(x, y, bins=10, range=None, normed=None, weights=None,
<ide> If False, the default, returns the number of samples in each bin.
<ide> If True, returns the probability *density* function at the bin,
<ide> ``bin_count / sample_count / bin_area``.
<del> normed : bool, optional
<del> An alias for the density argument that behaves identically. To avoid
<del> confusion with the broken normed argument to `histogram`, `density`
<del> should be preferred.
<ide> weights : array_like, shape(N,), optional
<ide> An array of values ``w_i`` weighing each sample ``(x_i, y_i)``.
<del> Weights are normalized to 1 if `normed` is True. If `normed` is
<add> Weights are normalized to 1 if `density` is True. If `density` is
<ide> False, the values of the returned histogram are equal to the sum of
<ide> the weights belonging to the samples falling into each bin.
<ide>
<ide> def histogram2d(x, y, bins=10, range=None, normed=None, weights=None,
<ide>
<ide> Notes
<ide> -----
<del> When `normed` is True, then the returned histogram is the sample
<add> When `density` is True, then the returned histogram is the sample
<ide> density, defined such that the sum over bins of the product
<ide> ``bin_value * bin_area`` is 1.
<ide>
<ide> def histogram2d(x, y, bins=10, range=None, normed=None, weights=None,
<ide> if N != 1 and N != 2:
<ide> xedges = yedges = asarray(bins)
<ide> bins = [xedges, yedges]
<del> hist, edges = histogramdd([x, y], bins, range, normed, weights, density)
<add> hist, edges = histogramdd([x, y], bins, range, density, weights)
<ide> return hist, edges[0], edges[1]
<ide>
<ide> | 3 |
Text | Text | update debugging_rails_applications [ci skip] | df497cf08590c9451b6ac1cf6d6ee86e304c0adf | <ide><path>guides/source/debugging_rails_applications.md
<ide> To see the previous ten lines you should type `list-` (or `l-`).
<ide> 7 byebug
<ide> 8 @articles = Article.find_recent
<ide> 9
<del> 10 respond_to do |format|
<add> 10 respond_to do |format|
<ide> ```
<ide>
<ide> This way you can move inside the file and see the code above the line where you
<ide> command later in this guide).
<ide> 7 byebug
<ide> 8 @articles = Article.find_recent
<ide> 9
<del>=> 10 respond_to do |format|
<del> 11 format.html # index.html.erb
<del> 12 format.json { render json: @articles }
<add>=> 10 respond_to do |format|
<add> 11 format.html # index.html.erb
<add> 12 format.json { render json: @articles }
<ide> 13 end
<ide> 14 end
<ide> 15 | 1 |
Python | Python | display only temperature stats | 9447bc63ead95f3a359bc3bd5452d52c024cff19 | <ide><path>glances/glances.py
<ide> def get(self):
<ide>
<ide> class glancesGrabSensors:
<ide> """
<del> Get Sensors stats using the PySensors lib
<add> Get sensors stats using the PySensors lib
<ide> """
<ide>
<ide> def __init__(self):
<ide> def __update__(self):
<ide> # Reset the list
<ide> self.sensors_list = []
<ide>
<del> # Open the current mounted FS
<add> # grab only temperature stats
<ide> if self.initok:
<ide> for chip in sensors.iter_detected_chips():
<ide> for feature in chip:
<ide> sensors_current = {}
<del> sensors_current['label'] = chip.prefix + " " + feature.label
<del> sensors_current['label'] = sensors_current['label'][-20:]
<del> sensors_current['value'] = feature.get_value()
<del> self.sensors_list.append(sensors_current)
<add> if feature.name.startswith('temp'):
<add> sensors_current['label'] = feature.label[:20]
<add> sensors_current['value'] = int(feature.get_value())
<add> self.sensors_list.append(sensors_current)
<ide>
<ide> def get(self):
<ide> self.__update__()
<ide> def displaySensors(self, sensors, offset_y=0):
<ide> screen_x > self.sensors_x + 28):
<ide> # Sensors header
<ide> self.term_window.addnstr(self.sensors_y, self.sensors_x,
<del> _("Sensors"), 8, self.title_color
<add> _("Sensors"), 7, self.title_color
<ide> if self.hascolors else curses.A_UNDERLINE)
<del> self.term_window.addnstr(self.sensors_y, self.sensors_x + 22,
<del> _("C"), 3)
<add> self.term_window.addnstr(self.sensors_y, self.sensors_x + 21,
<add> format(_("°C"), '>3'), 3)
<ide>
<ide> # Adapt the maximum interface to the screen
<ide> ret = 2
<ide> def displaySensors(self, sensors, offset_y=0):
<ide> self.sensors_y + 1 + i, self.sensors_x,
<ide> sensors[i]['label'] + ':', 21)
<ide> self.term_window.addnstr(
<del> self.sensors_y + 1 + i, self.sensors_x + 22,
<del> format(int(sensors[i]['value'])), 3)
<add> self.sensors_y + 1 + i, self.sensors_x + 20,
<add> format(sensors[i]['value'], '>3'), 3)
<ide> ret = ret + 1
<ide> return ret
<ide> return 0 | 1 |
Javascript | Javascript | remove extra div | 7a08e1b5f89040743f8a3e463c2e56bc9ed68ac8 | <ide><path>server/document.js
<ide> import PropTypes from 'prop-types'
<ide> import htmlescape from 'htmlescape'
<ide> import flush from 'styled-jsx/server'
<ide>
<add>function Fragment ({ children }) {
<add> return children
<add>}
<add>
<ide> export default class Document extends Component {
<ide> static getInitialProps ({ renderPage }) {
<ide> const { html, head, errorHtml, chunks } = renderPage()
<ide> export class Head extends Component {
<ide> }
<ide>
<ide> export class Main extends Component {
<del> static propTypes = {
<del> className: PropTypes.string
<del> }
<del>
<ide> static contextTypes = {
<ide> _documentProps: PropTypes.any
<ide> }
<ide>
<ide> render () {
<ide> const { html, errorHtml } = this.context._documentProps
<del> const { className } = this.props
<add>
<ide> return (
<del> <div className={className}>
<add> <Fragment>
<ide> <div id='__next' dangerouslySetInnerHTML={{ __html: html }} />
<ide> <div id='__next-error' dangerouslySetInnerHTML={{ __html: errorHtml }} />
<del> </div>
<add> </Fragment>
<ide> )
<ide> }
<ide> }
<ide> export class NextScript extends Component {
<ide> const { chunks, __NEXT_DATA__ } = this.context._documentProps
<ide> let { assetPrefix, buildId } = __NEXT_DATA__
<ide> return (
<del> <div>
<add> <Fragment>
<ide> {chunks.map((chunk) => (
<ide> <script
<ide> async
<ide> export class NextScript extends Component {
<ide> src={`${assetPrefix}/_next/${buildId}/webpack/chunks/${chunk}`}
<ide> />
<ide> ))}
<del> </div>
<add> </Fragment>
<ide> )
<ide> }
<ide>
<ide> export class NextScript extends Component {
<ide>
<ide> __NEXT_DATA__.chunks = chunks
<ide>
<del> return <div>
<add> return <Fragment>
<ide> {staticMarkup ? null : <script nonce={this.props.nonce} dangerouslySetInnerHTML={{
<ide> __html: `
<ide> __NEXT_DATA__ = ${htmlescape(__NEXT_DATA__)}
<ide> export class NextScript extends Component {
<ide> <script async id={`__NEXT_PAGE__/_error`} type='text/javascript' src={`${assetPrefix}/_next/${buildId}/page/_error/index.js`} />
<ide> {staticMarkup ? null : this.getDynamicChunks()}
<ide> {staticMarkup ? null : this.getScripts()}
<del> </div>
<add> </Fragment>
<ide> }
<ide> }
<ide> | 1 |
Javascript | Javascript | remove compose filtering | b4fb08133c95094a4b293a9ab434d1d5dd657527 | <ide><path>src/compose.js
<ide> */
<ide>
<ide> export default function compose(...funcs) {
<del> funcs = funcs.filter(func => typeof func === 'function')
<del>
<ide> if (funcs.length === 0) {
<ide> return arg => arg
<ide> }
<ide><path>test/compose.spec.js
<ide> describe('Utils', () => {
<ide> expect(compose(c, a, b)(final)('')).toBe('cab')
<ide> })
<ide>
<del> it('composes only functions', () => {
<add> it('throws at runtime if argument is not a function', () => {
<ide> const square = x => x * x
<ide> const add = (x, y) => x + y
<del>
<del> expect(compose(square, add, false)(1, 2)).toBe(9)
<del> expect(compose(square, add, undefined)(1, 2)).toBe(9)
<del> expect(compose(square, add, true)(1, 2)).toBe(9)
<del> expect(compose(square, add, NaN)(1, 2)).toBe(9)
<del> expect(compose(square, add, '42')(1, 2)).toBe(9)
<add>
<add> expect(() => compose(square, add, false)(1, 2)).toThrow()
<add> expect(() => compose(square, add, undefined)(1, 2)).toThrow()
<add> expect(() => compose(square, add, true)(1, 2)).toThrow()
<add> expect(() => compose(square, add, NaN)(1, 2)).toThrow()
<add> expect(() => compose(square, add, '42')(1, 2)).toThrow()
<ide> })
<ide>
<ide> it('can be seeded with multiple arguments', () => {
<ide> describe('Utils', () => {
<ide> it('returns the first given argument if given no functions', () => {
<ide> expect(compose()(1, 2)).toBe(1)
<ide> expect(compose()(3)).toBe(3)
<del> expect(compose(false,4,'test')(3)).toBe(3)
<ide> expect(compose()()).toBe(undefined)
<ide> })
<ide> | 2 |
Javascript | Javascript | add support for animation | 0b6f1ce5f89f47f9302ff1e8cd8f4b92f837c413 | <ide><path>angularFiles.js
<ide> angularFiles = {
<ide> 'src/auto/injector.js',
<ide>
<ide> 'src/ng/anchorScroll.js',
<add> 'src/ng/animation.js',
<add> 'src/ng/animator.js',
<ide> 'src/ng/browser.js',
<ide> 'src/ng/cacheFactory.js',
<ide> 'src/ng/compile.js',
<ide> angularFiles = {
<ide> 'src/ngMock/angular-mocks.js',
<ide> 'src/ngMobile/mobile.js',
<ide> 'src/ngMobile/directive/ngClick.js',
<del>
<ide> 'src/bootstrap/bootstrap.js'
<ide> ],
<ide>
<ide> angularFiles = {
<ide> 'test/ng/*.js',
<ide> 'test/ng/directive/*.js',
<ide> 'test/ng/filter/*.js',
<add> 'test/ngAnimate/*.js',
<ide> 'test/ngCookies/*.js',
<ide> 'test/ngResource/*.js',
<ide> 'test/ngSanitize/*.js',
<ide><path>docs/spec/ngdocSpec.js
<ide> describe('ngdoc', function() {
<ide> '<div><p>I am self.</p></div>');
<ide> });
<ide> });
<add>
<add> describe('@animations', function() {
<add> it('should render @this', function() {
<add> var doc = new Doc('@name a\n@animations\nenter - Add text\nleave - Remove text\n');
<add> doc.ngdoc = 'filter';
<add> doc.parse();
<add> expect(doc.html()).toContain(
<add> '<h3 id="Animations">Animations</h3>\n' +
<add> '<div class="animations">' +
<add> '<ul>' +
<add> '<li>enter - Add text</li>' +
<add> '<li>leave - Remove text</li>' +
<add> '</ul>' +
<add> '</div>');
<add> });
<add> });
<ide> });
<ide>
<ide> describe('usage', function() {
<ide><path>docs/src/dom.js
<ide> DOM.prototype = {
<ide> replace(/-+/gm, '-').
<ide> replace(/-*$/gm, '');
<ide> anchor = {'id': id};
<del> className = {'class': id.toLowerCase().replace(/[._]/mg, '-')};
<add> var classNameValue = id.toLowerCase().replace(/[._]/mg, '-');
<add> if(classNameValue == 'hide') classNameValue = '';
<add> className = {'class': classNameValue};
<ide> }
<ide> this.tag('h' + this.headingDepth, anchor, heading);
<ide> if (content instanceof Array) {
<ide><path>docs/src/ngdoc.js
<ide> Doc.prototype = {
<ide> });
<ide> dom.html(param.description);
<ide> });
<add> if(this.animations) {
<add> dom.h('Animations', this.animations, function(animations){
<add> dom.html('<ul>');
<add> var animations = animations.split("\n");
<add> animations.forEach(function(ani) {
<add> dom.html('<li>');
<add> dom.text(ani);
<add> dom.html('</li>');
<add> });
<add> dom.html('</ul>');
<add> });
<add> }
<ide> },
<ide>
<ide> html_usage_returns: function(dom) {
<ide> Doc.prototype = {
<ide> dom.text('</' + element + '>');
<ide> });
<ide> }
<add> if(self.animations) {
<add> var animations = [], matches = self.animations.split("\n");
<add> matches.forEach(function(ani) {
<add> var name = ani.match(/^\s*(.+?)\s*-/)[1];
<add> animations.push(name);
<add> });
<add>
<add> dom.html('with <span id="animations">animations</span>');
<add> var comment;
<add> if(animations.length == 1) {
<add> comment = 'The ' + animations[0] + ' animation is supported';
<add> }
<add> else {
<add> var rhs = animations[animations.length-1];
<add> var lhs = '';
<add> for(var i=0;i<animations.length-1;i++) {
<add> if(i>0) {
<add> lhs += ', ';
<add> }
<add> lhs += animations[i];
<add> }
<add> comment = 'The ' + lhs + ' and ' + rhs + ' animations are supported';
<add> }
<add> var element = self.element || 'ANY';
<add> dom.code(function() {
<add> dom.text('//' + comment + "\n");
<add> dom.text('<' + element + ' ');
<add> dom.text(dashCase(self.shortName));
<add> renderParams('\n ', '="', '"', true);
<add> dom.text(' ng-animate="{');
<add> animations.forEach(function(ani, index) {
<add> if (index) {
<add> dom.text(', ');
<add> }
<add> dom.text(ani + ': \'' + ani + '-animation\'');
<add> });
<add> dom.text('}">\n ...\n');
<add> dom.text('</' + element + '>');
<add> });
<add>
<add> dom.html('<a href="api/ng.$animator#Methods">Click here</a> to learn more about the steps involved in the animation.');
<add> }
<ide> }
<ide> self.html_usage_directiveInfo(dom);
<ide> self.html_usage_parameters(dom);
<ide><path>lib/showdown/showdown-0.9.js
<ide> var _EncodeCode = function(text) {
<ide>
<ide> var _DoItalicsAndBold = function(text) {
<ide>
<del> // <strong> must go first:
<add> // ** must go first:
<ide> text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,
<del> "<strong>$2</strong>");
<add> "**$2</strong>");
<ide>
<ide> text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,
<ide> "<em>$2</em>");
<ide> var escapeCharacters_callback = function(wholeMatch,m1) {
<ide> return "~E"+charCodeToEscape+"E";
<ide> }
<ide>
<del>} // end of Showdown.converter
<ide>\ No newline at end of file
<add>} // end of Showdown.converter
<ide><path>src/Angular.js
<ide> function inherit(parent, extra) {
<ide> return extend(new (extend(function() {}, {prototype:parent}))(), extra);
<ide> }
<ide>
<add>var START_SPACE = /^\s*/;
<add>var END_SPACE = /\s*$/;
<add>function stripWhitespace(str) {
<add> return isString(str) ? str.replace(START_SPACE, '').replace(END_SPACE, '') : str;
<add>}
<ide>
<ide> /**
<ide> * @ngdoc function
<ide><path>src/AngularPublic.js
<ide> function publishExternalAPI(angular){
<ide> directive(ngEventDirectives);
<ide> $provide.provider({
<ide> $anchorScroll: $AnchorScrollProvider,
<add> $animation: $AnimationProvider,
<add> $animator: $AnimatorProvider,
<ide> $browser: $BrowserProvider,
<ide> $cacheFactory: $CacheFactoryProvider,
<ide> $controller: $ControllerProvider,
<ide><path>src/loader.js
<ide> function setupModuleLoader(window) {
<ide> */
<ide> constant: invokeLater('$provide', 'constant', 'unshift'),
<ide>
<add> /**
<add> * @ngdoc method
<add> * @name angular.Module#animation
<add> * @methodOf angular.Module
<add> * @param {string} name animation name
<add> * @param {Function} animationFactory Factory function for creating new instance of an animation.
<add> * @description
<add> *
<add> * Defines an animation hook that can be later used with {@link ng.directive:ngAnimate ngAnimate}
<add> * alongside {@link ng.directive:ngAnimate#Description common ng directives} as well as custom directives.
<add> * <pre>
<add> * module.animation('animation-name', function($inject1, $inject2) {
<add> * return {
<add> * //this gets called in preparation to setup an animation
<add> * setup : function(element) { ... },
<add> *
<add> * //this gets called once the animation is run
<add> * start : function(element, done, memo) { ... }
<add> * }
<add> * })
<add> * </pre>
<add> *
<add> * See {@link ng.$animationProvider#register $animationProvider.register()} and
<add> * {@link ng.directive:ngAnimate ngAnimate} for more information.
<add> */
<add> animation: invokeLater('$animationProvider', 'register'),
<add>
<ide> /**
<ide> * @ngdoc method
<ide> * @name angular.Module#filter
<ide><path>src/ng/animation.js
<add>/**
<add> * @ngdoc object
<add> * @name ng.$animationProvider
<add> * @description
<add> *
<add> * The $AnimationProvider provider allows developers to register and access custom JavaScript animations directly inside
<add> * of a module.
<add> *
<add> */
<add>$AnimationProvider.$inject = ['$provide'];
<add>function $AnimationProvider($provide) {
<add> var suffix = 'Animation';
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.$animation#register
<add> * @methodOf ng.$animationProvider
<add> *
<add> * @description
<add> * Registers a new injectable animation factory function. The factory function produces the animation object which
<add> * has these two properties:
<add> *
<add> * * `setup`: `function(Element):*` A function which receives the starting state of the element. The purpose
<add> * of this function is to get the element ready for animation. Optionally the function returns an memento which
<add> * is passed to the `start` function.
<add> * * `start`: `function(Element, doneFunction, *)` The element to animate, the `doneFunction` to be called on
<add> * element animation completion, and an optional memento from the `setup` function.
<add> *
<add> * @param {string} name The name of the animation.
<add> * @param {function} factory The factory function that will be executed to return the animation object.
<add> *
<add> */
<add> this.register = function(name, factory) {
<add> $provide.factory(camelCase(name) + suffix, factory);
<add> };
<add>
<add> this.$get = ['$injector', function($injector) {
<add> /**
<add> * @ngdoc function
<add> * @name ng.$animation
<add> * @function
<add> *
<add> * @description
<add> * The $animation service is used to retrieve any defined animation functions. When executed, the $animation service
<add> * will return a object that contains the setup and start functions that were defined for the animation.
<add> *
<add> * @param {String} name Name of the animation function to retrieve. Animation functions are registered and stored
<add> * inside of the AngularJS DI so a call to $animate('custom') is the same as injecting `customAnimation`
<add> * via dependency injection.
<add> * @return {Object} the animation object which contains the `setup` and `start` functions that perform the animation.
<add> */
<add> return function $animation(name) {
<add> if (name) {
<add> try {
<add> return $injector.get(camelCase(name) + suffix);
<add> } catch (e) {
<add> //TODO(misko): this is a hack! we should have a better way to test if the injector has a given key.
<add> // The issue is that the animations are optional, and if not present they should be silently ignored.
<add> // The proper way to fix this is to add API onto the injector so that we can ask to see if a given
<add> // animation is supported.
<add> }
<add> }
<add> }
<add> }];
<add>};
<ide><path>src/ng/animator.js
<add>'use strict';
<add>
<add>// NOTE: this is a pseudo directive.
<add>
<add>/**
<add> * @ngdoc directive
<add> * @name ng.directive:ngAnimate
<add> *
<add> * @description
<add> * The `ngAnimate` directive works as an attribute that is attached alongside pre-existing directives.
<add> * It effects how the directive will perform DOM manipulation. This allows for complex animations to take place while
<add> * without burduning the directive which uses the animation with animation details. The built dn directives
<add> * `ngRepeat`, `ngInclude`, `ngSwitch`, `ngShow`, `ngHide` and `ngView` already accept `ngAnimate` directive.
<add> * Custom directives can take advantage of animation through {@link ng.$animator $animator service}.
<add> *
<add> * Below is a more detailed breakdown of the supported callback events provided by pre-exisitng ng directives:
<add> *
<add> * * {@link ng.directive:ngRepeat#animations ngRepeat} — enter, leave and move
<add> * * {@link ng.directive:ngView#animations ngView} — enter and leave
<add> * * {@link ng.directive:ngInclude#animations ngInclude} — enter and leave
<add> * * {@link ng.directive:ngSwitch#animations ngSwitch} — enter and leave
<add> * * {@link ng.directive:ngShow#animations ngShow & ngHide} - show and hide respectively
<add> *
<add> * You can find out more information about animations upon visiting each directive page.
<add> *
<add> * Below is an example of a directive that makes use of the ngAnimate attribute:
<add> *
<add> * <pre>
<add> * <!-- you can also use data-ng-animate, ng:animate or x-ng-animate as well -->
<add> * <ANY ng-directive ng-animate="{event1: 'animation-name', event2: 'animation-name-2'}"></ANY>
<add> *
<add> * <!-- you can also use a short hand -->
<add> * <ANY ng-directive ng-animate=" 'animation' "></ANY>
<add> * <!-- which expands to -->
<add> * <ANY ng-directive ng-animate="{ enter: 'animation-enter', leave: 'animation-leave', ...}"></ANY>
<add> *
<add> * <!-- keep in mind that ng-animate can take expressions -->
<add> * <ANY ng-directive ng-animate=" computeCurrentAnimation() "></ANY>
<add> * </pre>
<add> *
<add> * The `event1` and `event2` attributes refer to the animation events specific to the directive that has been assigned.
<add> *
<add> * <h2>CSS-defined Animations</h2>
<add> * By default, ngAnimate attaches two CSS3 classes per animation event to the DOM element to achieve the animation.
<add> * This is up to you, the developer, to ensure that the animations take place using cross-browser CSS3 transitions.
<add> * All that is required is the following CSS code:
<add> *
<add> * <pre>
<add> * <style type="text/css">
<add> * /*
<add> * The animate-enter prefix is the event name that you
<add> * have provided within the ngAnimate attribute.
<add> * */
<add> * .animate-enter-setup {
<add> * -webkit-transition: 1s linear all; /* Safari/Chrome */
<add> * -moz-transition: 1s linear all; /* Firefox */
<add> * -ms-transition: 1s linear all; /* IE10 */
<add> * -o-transition: 1s linear all; /* Opera */
<add> * transition: 1s linear all; /* Future Browsers */
<add> *
<add> * /* The animation preparation code */
<add> * opacity: 0;
<add> * }
<add> *
<add> * /*
<add> * Keep in mind that you want to combine both CSS
<add> * classes together to avoid any CSS-specificity
<add> * conflicts
<add> * */
<add> * .animate-enter-setup.animate-enter-start {
<add> * /* The animation code itself */
<add> * opacity: 1;
<add> * }
<add> * </style>
<add> *
<add> * <div ng-directive ng-animate="{enter: 'animate-enter'}"></div>
<add> * </pre>
<add> *
<add> * Upon DOM mutation, the setup class is added first, then the browser is allowed to reflow the content and then,
<add> * the start class is added to trigger the animation. The ngAnimate directive will automatically extract the duration
<add> * of the animation to determine when the animation ends. Once the animation is over then both CSS classes will be
<add> * removed from the DOM. If a browser does not support CSS transitions then the animation will start and end
<add> * immediately resulting in a DOM element that is at it's final state. This final state is when the DOM element
<add> * has no CSS animation classes surrounding it.
<add> *
<add> * <h2>JavaScript-defined Animations</h2>
<add> * In the event that you do not want to use CSS3 animations or if you wish to offer animations to browsers that do not
<add> * yet support them, then you can make use of JavaScript animations defined inside ngModule.
<add> *
<add> * <pre>
<add> * var ngModule = angular.module('YourApp', []);
<add> * ngModule.animation('animate-enter', function() {
<add> * return {
<add> * setup : function(element) {
<add> * //prepare the element for animation
<add> * element.css({ 'opacity': 0 });
<add> * var memo = "..."; //this value is passed to the start function
<add> * return memo;
<add> * },
<add> * start : function(element, done, memo) {
<add> * //start the animation
<add> * element.animate({
<add> * 'opacity' : 1
<add> * }, function() {
<add> * //call when the animation is complete
<add> * done()
<add> * });
<add> * }
<add> * }
<add> * });
<add> * </pre>
<add> *
<add> * As you can see, the JavaScript code follows a similar template to the CSS3 animations. Once defined, the animation
<add> * can be used in the same way with the ngAnimate attribute. Keep in mind that, when using JavaScript-enabled
<add> * animations, ngAnimate will also add in the same CSS classes that CSS-enabled animations do (even if you're using
<add> * JavaScript animations) to animated the element, but it will not attempt to find any CSS3 transition duration value.
<add> * It will instead close off the animation once the provided done function is executed. So it's important that you
<add> * make sure your animations remember to fire off the done function once the animations are complete.
<add> *
<add> * @param {expression} ngAnimate Used to configure the DOM manipulation animations.
<add> *
<add> */
<add>
<add>/**
<add> * @ngdoc function
<add> * @name ng.$animator
<add> *
<add> * @description
<add> * The $animator service provides the DOM manipulation API which is decorated with animations.
<add> *
<add> * @param {Scope} scope the scope for the ng-animate.
<add> * @param {Attributes} attr the attributes object which contains the ngAnimate key / value pair. (The attributes are
<add> * passed into the linking function of the directive using the `$animator`.)
<add> * @return {object} the animator object which contains the enter, leave, move, show, hide and animate methods.
<add> */
<add>var $AnimatorProvider = function() {
<add> this.$get = ['$animation', '$window', '$sniffer', function($animation, $window, $sniffer) {
<add> return function(scope, attrs) {
<add> var ngAnimateAttr = attrs.ngAnimate;
<add> var animator = {};
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.animator#enter
<add> * @methodOf ng.$animator
<add> * @function
<add> *
<add> * @description
<add> * Injects the element object into the DOM (inside of the parent element) and then runs the enter animation.
<add> *
<add> * @param {jQuery/jqLite element} element the element that will be the focus of the enter animation
<add> * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the enter animation
<add> * @param {jQuery/jqLite element} after the sibling element (which is the previous element) of the element that will be the focus of the enter animation
<add> */
<add> animator.enter = animateActionFactory('enter', insert, noop);
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.animator#leave
<add> * @methodOf ng.$animator
<add> * @function
<add> *
<add> * @description
<add> * Runs the leave animation operation and, upon completion, removes the element from the DOM.
<add> *
<add> * @param {jQuery/jqLite element} element the element that will be the focus of the leave animation
<add> * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the leave animation
<add> */
<add> animator.leave = animateActionFactory('leave', noop, remove);
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.animator#move
<add> * @methodOf ng.$animator
<add> * @function
<add> *
<add> * @description
<add> * Fires the move DOM operation. Just before the animation starts, the animator will either append it into the parent container or
<add> * add the element directly after the after element if present. Then the move animation will be run.
<add> *
<add> * @param {jQuery/jqLite element} element the element that will be the focus of the move animation
<add> * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the move animation
<add> * @param {jQuery/jqLite element} after the sibling element (which is the previous element) of the element that will be the focus of the move animation
<add> */
<add> animator.move = animateActionFactory('move', move, noop);
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.animator#show
<add> * @methodOf ng.$animator
<add> * @function
<add> *
<add> * @description
<add> * Reveals the element by setting the CSS property `display` to `block` and then starts the show animation directly after.
<add> *
<add> * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden
<add> */
<add> animator.show = animateActionFactory('show', show, noop);
<add>
<add> /**
<add> * @ngdoc function
<add> * @name ng.animator#hide
<add> * @methodOf ng.$animator
<add> *
<add> * @description
<add> * Starts the hide animation first and sets the CSS `display` property to `none` upon completion.
<add> *
<add> * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden
<add> */
<add> animator.hide = animateActionFactory('hide', noop, hide);
<add> return animator;
<add>
<add> function animateActionFactory(type, beforeFn, afterFn) {
<add> var ngAnimateValue = ngAnimateAttr && scope.$eval(ngAnimateAttr);
<add> var className = ngAnimateAttr
<add> ? isObject(ngAnimateValue) ? ngAnimateValue[type] : ngAnimateValue + '-' + type
<add> : '';
<add> var animationPolyfill = $animation(className);
<add>
<add> var polyfillSetup = animationPolyfill && animationPolyfill.setup;
<add> var polyfillStart = animationPolyfill && animationPolyfill.start;
<add>
<add> if (!className) {
<add> return function(element, parent, after) {
<add> beforeFn(element, parent, after);
<add> afterFn(element, parent, after);
<add> }
<add> } else {
<add> var setupClass = className + '-setup';
<add> var startClass = className + '-start';
<add>
<add> return function(element, parent, after) {
<add> if (!$sniffer.supportsTransitions && !polyfillSetup && !polyfillStart) {
<add> beforeFn(element, parent, after);
<add> afterFn(element, parent, after);
<add> return;
<add> }
<add>
<add> element.addClass(setupClass);
<add> beforeFn(element, parent, after);
<add> if (element.length == 0) return done();
<add>
<add> var memento = (noop || polyfillSetup)(element);
<add>
<add> // $window.setTimeout(beginAnimation, 0); this was causing the element not to animate
<add> // keep at 1 for animation dom rerender
<add> $window.setTimeout(beginAnimation, 1);
<add>
<add> function beginAnimation() {
<add> element.addClass(startClass);
<add> if (polyfillStart) {
<add> polyfillStart(element, done, memento);
<add> } else if (isFunction($window.getComputedStyle)) {
<add> var vendorTransitionProp = $sniffer.vendorPrefix + 'Transition';
<add> var w3cTransitionProp = 'transition'; //one day all browsers will have this
<add>
<add> var durationKey = 'Duration';
<add> var duration = 0;
<add> //we want all the styles defined before and after
<add> forEach(element, function(element) {
<add> var globalStyles = $window.getComputedStyle(element) || {};
<add> duration = Math.max(
<add> parseFloat(globalStyles[w3cTransitionProp + durationKey]) ||
<add> parseFloat(globalStyles[vendorTransitionProp + durationKey]) ||
<add> 0,
<add> duration);
<add> });
<add>
<add> $window.setTimeout(done, duration * 1000);
<add> } else {
<add> dump(3)
<add> done();
<add> }
<add> }
<add>
<add> function done() {
<add> afterFn(element, parent, after);
<add> element.removeClass(setupClass);
<add> element.removeClass(startClass);
<add> }
<add> }
<add> }
<add> }
<add> }
<add>
<add> function show(element) {
<add> element.css('display', 'block');
<add> }
<add>
<add> function hide(element) {
<add> element.css('display', 'none');
<add> }
<add>
<add> function insert(element, parent, after) {
<add> if (after) {
<add> after.after(element);
<add> } else {
<add> parent.append(element);
<add> }
<add> }
<add>
<add> function remove(element) {
<add> element.remove();
<add> }
<add>
<add> function move(element, parent, after) {
<add> // Do not remove element before insert. Removing will cause data associated with the
<add> // element to be dropped. Insert will implicitly do the remove.
<add> insert(element, parent, after);
<add> }
<add> }];
<add>};
<ide><path>src/ng/directive/ngInclude.js
<ide> * (e.g. ngInclude won't work for cross-domain requests on all browsers and for
<ide> * file:// access on some browsers).
<ide> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**
<add> * and **leave** effects.
<add> *
<add> * @animations
<add> * enter - happens just after the ngInclude contents change and a new DOM element is created and injected into the ngInclude container
<add> * leave - happens just after the ngInclude contents change and just before the former contents are removed from the DOM
<add> *
<ide> * @scope
<ide> *
<ide> * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
<ide> * @description
<ide> * Emitted every time the ngInclude content is reloaded.
<ide> */
<del>var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile',
<del> function($http, $templateCache, $anchorScroll, $compile) {
<add>var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', '$animator',
<add> function($http, $templateCache, $anchorScroll, $compile, $animator) {
<ide> return {
<ide> restrict: 'ECA',
<ide> terminal: true,
<ide> var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
<ide> onloadExp = attr.onload || '',
<ide> autoScrollExp = attr.autoscroll;
<ide>
<del> return function(scope, element) {
<add> return function(scope, element, attr) {
<add> var animate = $animator(scope, attr);
<ide> var changeCounter = 0,
<ide> childScope;
<ide>
<ide> var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
<ide> childScope.$destroy();
<ide> childScope = null;
<ide> }
<del>
<del> element.html('');
<add> animate.leave(element.contents(), element);
<ide> };
<ide>
<ide> scope.$watch(srcExp, function ngIncludeWatchAction(src) {
<ide> var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
<ide>
<ide> if (childScope) childScope.$destroy();
<ide> childScope = scope.$new();
<add> animate.leave(element.contents(), element);
<ide>
<del> element.html(response);
<del> $compile(element.contents())(childScope);
<add> var contents = jqLite('<div/>').html(response).contents();
<add>
<add> animate.enter(contents, element);
<add> $compile(contents)(childScope);
<ide>
<ide> if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
<ide> $anchorScroll();
<ide> var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
<ide> }).error(function() {
<ide> if (thisChangeId === changeCounter) clearContent();
<ide> });
<del> } else clearContent();
<add> } else {
<add> clearContent();
<add> }
<ide> });
<ide> };
<ide> }
<ide><path>src/ng/directive/ngRepeat.js
<ide> * * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator.
<ide> * * `$last` – `{boolean}` – true if the repeated element is last in the iterator.
<ide> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**,
<add> * **leave** and **move** effects.
<add> *
<add> * @animations
<add> * enter - when a new item is added to the list or when an item is revealed after a filter
<add> * leave - when an item is removed from the list or when an item is filtered out
<add> * move - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
<ide> *
<ide> * @element ANY
<ide> * @scope
<ide> </doc:scenario>
<ide> </doc:example>
<ide> */
<del>var ngRepeatDirective = ['$parse', function($parse) {
<add>var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) {
<add> var NG_REMOVED = '$$NG_REMOVED';
<ide> return {
<ide> transclude: 'element',
<ide> priority: 1000,
<ide> terminal: true,
<ide> compile: function(element, attr, linker) {
<ide> return function($scope, $element, $attr){
<add> var animate = $animator($scope, $attr);
<ide> var expression = $attr.ngRepeat;
<ide> var match = expression.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/),
<ide> trackByExp, hashExpFn, trackByIdFn, lhs, rhs, valueIdentifier, keyIdentifier,
<ide> var ngRepeatDirective = ['$parse', function($parse) {
<ide> $scope.$watchCollection(rhs, function ngRepeatAction(collection){
<ide> var index, length,
<ide> cursor = $element, // current position of the node
<add> nextCursor,
<ide> // Same as lastBlockMap but it has the current state. It will become the
<ide> // lastBlockMap on the next iteration.
<ide> nextBlockMap = {},
<ide> var ngRepeatDirective = ['$parse', function($parse) {
<ide> for (key in lastBlockMap) {
<ide> if (lastBlockMap.hasOwnProperty(key)) {
<ide> block = lastBlockMap[key];
<del> block.element.remove();
<add> animate.leave(block.element);
<add> block.element[0][NG_REMOVED] = true;
<ide> block.scope.$destroy();
<ide> }
<ide> }
<ide> var ngRepeatDirective = ['$parse', function($parse) {
<ide> // associated scope/element
<ide> childScope = block.scope;
<ide>
<del> if (block.element == cursor) {
<add> nextCursor = cursor[0];
<add> do {
<add> nextCursor = nextCursor.nextSibling;
<add> } while(nextCursor && nextCursor[NG_REMOVED]);
<add>
<add> if (block.element[0] == nextCursor) {
<ide> // do nothing
<ide> cursor = block.element;
<ide> } else {
<ide> // existing item which got moved
<del> cursor.after(block.element);
<add> animate.move(block.element, null, cursor);
<ide> cursor = block.element;
<ide> }
<ide> } else {
<ide> var ngRepeatDirective = ['$parse', function($parse) {
<ide> childScope.$middle = !(childScope.$first || childScope.$last);
<ide>
<ide> if (!block.element) {
<del> linker(childScope, function(clone){
<del> cursor.after(clone);
<add> linker(childScope, function(clone) {
<add> animate.enter(clone, null, cursor);
<ide> cursor = clone;
<ide> block.scope = childScope;
<ide> block.element = clone;
<ide> var ngRepeatDirective = ['$parse', function($parse) {
<ide> }
<ide> };
<ide> }];
<add>
<ide><path>src/ng/directive/ngShowHide.js
<ide> *
<ide> * @description
<ide> * The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML)
<del> * conditionally.
<add> * conditionally based on **"truthy"** values evaluated within an {expression}. In other
<add> * words, if the expression assigned to **ngShow evaluates to a true value** then **the element is set to visible**
<add> * (via `display:block` in css) and **if false** then **the element is set to hidden** (so display:none).
<add> * With ngHide this is the reverse whereas true values cause the element itself to become
<add> * hidden.
<add> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **show**
<add> * and **hide** effects.
<add> *
<add> * @animations
<add> * show - happens after the ngShow expression evaluates to a truthy value and the contents are set to visible
<add> * hide - happens before the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden
<ide> *
<ide> * @element ANY
<ide> * @param {expression} ngShow If the {@link guide/expression expression} is truthy
<ide> </doc:example>
<ide> */
<ide> //TODO(misko): refactor to remove element from the DOM
<del>var ngShowDirective = ngDirective(function(scope, element, attr){
<del> scope.$watch(attr.ngShow, function ngShowWatchAction(value){
<del> element.css('display', toBoolean(value) ? '' : 'none');
<del> });
<del>});
<add>var ngShowDirective = ['$animator', function($animator) {
<add> return function(scope, element, attr) {
<add> var animate = $animator(scope, attr);
<add> scope.$watch(attr.ngShow, function ngShowWatchAction(value){
<add> animate[toBoolean(value) ? 'show' : 'hide'](element);
<add> });
<add> };
<add>}];
<ide>
<ide>
<ide> /**
<ide> * @ngdoc directive
<ide> * @name ng.directive:ngHide
<ide> *
<ide> * @description
<del> * The `ngHide` and `ngShow` directives hide or show a portion of the DOM tree (HTML)
<del> * conditionally.
<add> * The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML)
<add> * conditionally based on **"truthy"** values evaluated within an {expression}. In other
<add> * words, if the expression assigned to **ngShow evaluates to a true value** then **the element is set to visible**
<add> * (via `display:block` in css) and **if false** then **the element is set to hidden** (so display:none).
<add> * With ngHide this is the reverse whereas true values cause the element itself to become
<add> * hidden.
<add> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **show**
<add> * and **hide** effects.
<add> *
<add> * @animations
<add> * show - happens after the ngHide expression evaluates to a non truthy value and the contents are set to visible
<add> * hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden
<ide> *
<ide> * @element ANY
<ide> * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
<ide> var ngShowDirective = ngDirective(function(scope, element, attr){
<ide> </doc:example>
<ide> */
<ide> //TODO(misko): refactor to remove element from the DOM
<del>var ngHideDirective = ngDirective(function(scope, element, attr){
<del> scope.$watch(attr.ngHide, function ngHideWatchAction(value){
<del> element.css('display', toBoolean(value) ? 'none' : '');
<del> });
<del>});
<add>var ngHideDirective = ['$animator', function($animator) {
<add> return function(scope, element, attr) {
<add> var animate = $animator(scope, attr);
<add> scope.$watch(attr.ngHide, function ngHideWatchAction(value){
<add> animate[toBoolean(value) ? 'hide' : 'show'](element);
<add> });
<add> };
<add>}];
<ide><path>src/ng/directive/ngSwitch.js
<ide> * @restrict EA
<ide> *
<ide> * @description
<del> * Conditionally change the DOM structure. Elements within ngSwitch but without
<del> * ngSwitchWhen or ngSwitchDefault directives will be preserved at the location
<del> * as specified in the template
<add> * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression.
<add> * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location
<add> * as specified in the template.
<add> *
<add> * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
<add> * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element
<add> * matches the value obtained from the evaluated expression. In other words, you define a container element
<add> * (where you place the directive), place an expression on the **on="..." attribute**
<add> * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place
<add> * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
<add> * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
<add> * attribute is displayed.
<add> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**
<add> * and **leave** effects.
<add> *
<add> * @animations
<add> * enter - happens after the ngSwtich contents change and the matched child element is placed inside the container
<add> * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
<ide> *
<ide> * @usage
<ide> * <ANY ng-switch="expression">
<ide> * <ANY ng-switch-when="matchValue1">...</ANY>
<ide> * <ANY ng-switch-when="matchValue2">...</ANY>
<del> * ...
<ide> * <ANY ng-switch-default>...</ANY>
<ide> * </ANY>
<ide> *
<ide> </doc:scenario>
<ide> </doc:example>
<ide> */
<del>var NG_SWITCH = 'ng-switch';
<del>var ngSwitchDirective = valueFn({
<del> restrict: 'EA',
<del> require: 'ngSwitch',
<del> // asks for $scope to fool the BC controller module
<del> controller: ['$scope', function ngSwitchController() {
<del> this.cases = {};
<del> }],
<del> link: function(scope, element, attr, ctrl) {
<del> var watchExpr = attr.ngSwitch || attr.on,
<del> selectedTranscludes,
<del> selectedElements,
<del> selectedScopes = [];
<add>var ngSwitchDirective = ['$animator', function($animator) {
<add> return {
<add> restrict: 'EA',
<add> require: 'ngSwitch',
<ide>
<del> scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
<del> for (var i= 0, ii=selectedScopes.length; i<ii; i++) {
<del> selectedScopes[i].$destroy();
<del> selectedElements[i].remove();
<del> }
<add> // asks for $scope to fool the BC controller module
<add> controller: ['$scope', function ngSwitchController() {
<add> this.cases = {};
<add> }],
<add> link: function(scope, element, attr, ngSwitchController) {
<add> var animate = $animator(scope, attr);
<add> var watchExpr = attr.ngSwitch || attr.on,
<add> selectedTranscludes,
<add> selectedElements,
<add> selectedScopes = [];
<ide>
<del> selectedElements = [];
<del> selectedScopes = [];
<add> scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
<add> for (var i= 0, ii=selectedScopes.length; i<ii; i++) {
<add> selectedScopes[i].$destroy();
<add> animate.leave(selectedElements[i]);
<add> }
<ide>
<del> if ((selectedTranscludes = ctrl.cases['!' + value] || ctrl.cases['?'])) {
<del> scope.$eval(attr.change);
<del> forEach(selectedTranscludes, function(selectedTransclude) {
<del> var selectedScope = scope.$new();
<del> selectedScopes.push(selectedScope);
<del> selectedTransclude.transclude(selectedScope, function(caseElement) {
<del> selectedElements.push(caseElement);
<del> selectedTransclude.element.after(caseElement);
<add> selectedElements = [];
<add> selectedScopes = [];
<add>
<add> if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
<add> scope.$eval(attr.change);
<add> forEach(selectedTranscludes, function(selectedTransclude) {
<add> var selectedScope = scope.$new();
<add> selectedScopes.push(selectedScope);
<add> selectedTransclude.transclude(selectedScope, function(caseElement) {
<add> var anchor = selectedTransclude.element;
<add>
<add> selectedElements.push(caseElement);
<add> animate.enter(caseElement, anchor.parent(), anchor);
<add> });
<ide> });
<del> });
<del> }
<del> });
<add> }
<add> });
<add> }
<ide> }
<del>});
<add>}];
<ide>
<ide> var ngSwitchWhenDirective = ngDirective({
<ide> transclude: 'element',
<ide><path>src/ng/directive/ngView.js
<ide> * Every time the current route changes, the included view changes with it according to the
<ide> * configuration of the `$route` service.
<ide> *
<add> * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**
<add> * and **leave** effects.
<add> *
<add> * @animations
<add> * enter - happens just after the ngView contents are changed (when the new view DOM element is inserted into the DOM)
<add> * leave - happens just after the current ngView contents change and just before the former contents are removed from the DOM
<add> *
<ide> * @scope
<ide> * @example
<ide> <example module="ngView">
<ide> * Emitted every time the ngView content is reloaded.
<ide> */
<ide> var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$compile',
<del> '$controller',
<add> '$controller', '$animator',
<ide> function($http, $templateCache, $route, $anchorScroll, $compile,
<del> $controller) {
<add> $controller, $animator) {
<ide> return {
<ide> restrict: 'ECA',
<ide> terminal: true,
<ide> link: function(scope, element, attr) {
<ide> var lastScope,
<del> onloadExp = attr.onload || '';
<add> onloadExp = attr.onload || '',
<add> animate = $animator(scope, attr);
<ide>
<ide> scope.$on('$routeChangeSuccess', update);
<ide> update();
<ide> var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c
<ide> }
<ide>
<ide> function clearContent() {
<del> element.html('');
<add> animate.leave(element.contents(), element);
<ide> destroyLastScope();
<ide> }
<ide>
<ide> var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c
<ide> template = locals && locals.$template;
<ide>
<ide> if (template) {
<del> element.html(template);
<del> destroyLastScope();
<add> clearContent();
<add> animate.enter(jqLite('<div></div>').html(template).contents(), element);
<ide>
<ide> var link = $compile(element.contents()),
<ide> current = $route.current,
<ide><path>src/ng/sniffer.js
<ide> *
<ide> * @property {boolean} history Does the browser support html5 history api ?
<ide> * @property {boolean} hashchange Does the browser support hashchange event ?
<add> * @property {boolean} supportsTransitions Does the browser support CSS transition events ?
<ide> *
<ide> * @description
<ide> * This is very simple implementation of testing browser's features.
<ide> */
<ide> function $SnifferProvider() {
<ide> this.$get = ['$window', '$document', function($window, $document) {
<ide> var eventSupport = {},
<del> android = int((/android (\d+)/.exec(lowercase($window.navigator.userAgent)) || [])[1]),
<del> document = $document[0];
<add> android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
<add> document = $document[0] || {},
<add> vendorPrefix,
<add> vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
<add> bodyStyle = document.body && document.body.style,
<add> transitions = false,
<add> match;
<add>
<add> if (bodyStyle) {
<add> for(var prop in bodyStyle) {
<add> if(match = vendorRegex.exec(prop)) {
<add> vendorPrefix = match[0];
<add> vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
<add> break;
<add> }
<add> }
<add> transitions = !!(vendorPrefix + 'Transition' in bodyStyle);
<add> }
<add>
<ide>
<ide> return {
<ide> // Android has history.pushState, but it does not update location correctly
<ide> function $SnifferProvider() {
<ide>
<ide> return eventSupport[event];
<ide> },
<del> csp: document.securityPolicy ? document.securityPolicy.isActive : false
<add> csp: document.securityPolicy ? document.securityPolicy.isActive : false,
<add> vendorPrefix: vendorPrefix,
<add> supportsTransitions : transitions
<ide> };
<ide> }];
<ide> }
<ide><path>src/ngMock/angular-mocks.js
<ide> angular.mock.$LogProvider = function() {
<ide> angular.mock.TzDate.prototype = Date.prototype;
<ide> })();
<ide>
<add>/**
<add> * @ngdoc function
<add> * @name angular.mock.createMockWindow
<add> * @description
<add> *
<add> * This function creates a mock window object useful for controlling access ot setTimeout, but mocking out
<add> * sufficient window's properties to allow Angular to execute.
<add> *
<add> * @example
<add> *
<add> * <pre>
<add> beforeEach(module(function($provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> }));
<add>
<add> it('should do something', inject(function($window) {
<add> var val = null;
<add> $window.setTimeout(function() { val = 123; }, 10);
<add> expect(val).toEqual(null);
<add> window.setTimeout.expect(10).process();
<add> expect(val).toEqual(123);
<add> });
<add> * </pre>
<add> *
<add> */
<add>angular.mock.createMockWindow = function() {
<add> var mockWindow = {};
<add> var setTimeoutQueue = [];
<add>
<add> mockWindow.document = window.document;
<add> mockWindow.getComputedStyle = angular.bind(window, window.getComputedStyle);
<add> mockWindow.scrollTo = angular.bind(window, window.scrollTo);
<add> mockWindow.navigator = window.navigator;
<add> mockWindow.setTimeout = function(fn, delay) {
<add> setTimeoutQueue.push({fn: fn, delay: delay});
<add> };
<add> mockWindow.setTimeout.queue = setTimeoutQueue;
<add> mockWindow.setTimeout.expect = function(delay) {
<add> if (setTimeoutQueue.length > 0) {
<add> return {
<add> process: function() {
<add> setTimeoutQueue.shift().fn();
<add> }
<add> };
<add> } else {
<add> expect('SetTimoutQueue empty. Expecting delay of ').toEqual(delay);
<add> }
<add> };
<add>
<add> return mockWindow;
<add>};
<ide>
<ide> /**
<ide> * @ngdoc function
<ide><path>test/ng/animationSpec.js
<add>'use strict';
<add>
<add>describe('$animation', function() {
<add>
<add> it('should allow animation registration', function() {
<add> var noopCustom = function(){};
<add> module(function($animationProvider) {
<add> $animationProvider.register('noop-custom', valueFn(noopCustom));
<add> });
<add> inject(function($animation) {
<add> expect($animation('noop-custom')).toBe(noopCustom);
<add> });
<add> });
<add>
<add>});
<ide><path>test/ng/animatorSpec.js
<add>'use strict';
<add>
<add>describe("$animator", function() {
<add>
<add> var element;
<add>
<add> afterEach(function(){
<add> dealoc(element);
<add> });
<add>
<add> describe("without animation", function() {
<add> var window, animator;
<add>
<add> beforeEach(function() {
<add> module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> })
<add> inject(function($animator, $compile, $rootScope) {
<add> animator = $animator($rootScope, {});
<add> element = $compile('<div></div>')($rootScope);
<add> })
<add> });
<add>
<add> it("should add element at the start of enter animation", inject(function($animator, $compile, $rootScope) {
<add> var child = $compile('<div></div>')($rootScope);
<add> expect(element.contents().length).toBe(0);
<add> animator.enter(child, element);
<add> expect(element.contents().length).toBe(1);
<add> }));
<add>
<add> it("should remove the element at the end of leave animation", inject(function($animator, $compile, $rootScope) {
<add> var child = $compile('<div></div>')($rootScope);
<add> element.append(child);
<add> expect(element.contents().length).toBe(1);
<add> animator.leave(child, element);
<add> expect(element.contents().length).toBe(0);
<add> }));
<add>
<add> it("should reorder the move animation", inject(function($animator, $compile, $rootScope) {
<add> var child1 = $compile('<div>1</div>')($rootScope);
<add> var child2 = $compile('<div>2</div>')($rootScope);
<add> element.append(child1);
<add> element.append(child2);
<add> expect(element.text()).toBe('12');
<add> animator.move(child1, element, child2);
<add> expect(element.text()).toBe('21');
<add> }));
<add>
<add> it("should animate the show animation event", inject(function($animator, $compile, $rootScope) {
<add> element.css('display','none');
<add> expect(element.css('display')).toBe('none');
<add> animator.show(element);
<add> expect(element.css('display')).toBe('block');
<add> }));
<add>
<add> it("should animate the hide animation event", inject(function($animator, $compile, $rootScope) {
<add> element.css('display','block');
<add> expect(element.css('display')).toBe('block');
<add> animator.hide(element);
<add> expect(element.css('display')).toBe('none');
<add> }));
<add>
<add> });
<add>
<add> describe("with polyfill", function() {
<add>
<add> var child, after, window, animator;
<add>
<add> beforeEach(function() {
<add> module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> $animationProvider.register('custom', function() {
<add> return {
<add> start: function(element, done) {
<add> done();
<add> }
<add> }
<add> });
<add> })
<add> inject(function($animator, $compile, $rootScope) {
<add> element = $compile('<div></div>')($rootScope);
<add> child = $compile('<div></div>')($rootScope);
<add> after = $compile('<div></div>')($rootScope);
<add> });
<add> })
<add>
<add> it("should animate the enter animation event", inject(function($animator, $rootScope) {
<add> animator = $animator($rootScope, {
<add> ngAnimate : '{enter: \'custom\'}'
<add> });
<add> expect(element.contents().length).toBe(0);
<add> animator.enter(child, element);
<add> window.setTimeout.expect(1).process();
<add> }));
<add>
<add> it("should animate the leave animation event", inject(function($animator, $rootScope) {
<add> animator = $animator($rootScope, {
<add> ngAnimate : '{leave: \'custom\'}'
<add> });
<add> element.append(child);
<add> expect(element.contents().length).toBe(1);
<add> animator.leave(child, element);
<add> window.setTimeout.expect(1).process();
<add> expect(element.contents().length).toBe(0);
<add> }));
<add>
<add> it("should animate the move animation event", inject(function($animator, $compile, $rootScope) {
<add> animator = $animator($rootScope, {
<add> ngAnimate : '{move: \'custom\'}'
<add> });
<add> var child1 = $compile('<div>1</div>')($rootScope);
<add> var child2 = $compile('<div>2</div>')($rootScope);
<add> element.append(child1);
<add> element.append(child2);
<add> expect(element.text()).toBe('12');
<add> animator.move(child1, element, child2);
<add> expect(element.text()).toBe('21');
<add> window.setTimeout.expect(1).process();
<add> }));
<add>
<add> it("should animate the show animation event", inject(function($animator, $rootScope) {
<add> animator = $animator($rootScope, {
<add> ngAnimate : '{show: \'custom\'}'
<add> });
<add> element.css('display','none');
<add> expect(element.css('display')).toBe('none');
<add> animator.show(element);
<add> expect(element.css('display')).toBe('block');
<add> window.setTimeout.expect(1).process();
<add> expect(element.css('display')).toBe('block');
<add> }));
<add>
<add> it("should animate the hide animation event", inject(function($animator, $rootScope) {
<add> animator = $animator($rootScope, {
<add> ngAnimate : '{hide: \'custom\'}'
<add> });
<add> element.css('display','block');
<add> expect(element.css('display')).toBe('block');
<add> animator.hide(element);
<add> expect(element.css('display')).toBe('block');
<add> window.setTimeout.expect(1).process();
<add> expect(element.css('display')).toBe('none');
<add> }));
<add>
<add> it("should assign the ngAnimate string to all events if a string is given",
<add> inject(function($animator, $sniffer, $rootScope) {
<add> if (!$sniffer.supportsTransitions) return;
<add> animator = $animator($rootScope, {
<add> ngAnimate : '"custom"'
<add> });
<add>
<add> //enter
<add> animator.enter(child, element);
<add> expect(child.attr('class')).toContain('custom-enter-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(child.attr('class')).toContain('custom-enter-start');
<add> window.setTimeout.expect(0).process();
<add>
<add> //leave
<add> element.append(after);
<add> animator.move(child, element, after);
<add> expect(child.attr('class')).toContain('custom-move-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(child.attr('class')).toContain('custom-move-start');
<add> window.setTimeout.expect(0).process();
<add>
<add> //hide
<add> animator.hide(child);
<add> expect(child.attr('class')).toContain('custom-hide-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(child.attr('class')).toContain('custom-hide-start');
<add> window.setTimeout.expect(0).process();
<add>
<add> //show
<add> animator.show(child);
<add> expect(child.attr('class')).toContain('custom-show-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(child.attr('class')).toContain('custom-show-start');
<add> window.setTimeout.expect(0).process();
<add>
<add> //leave
<add> animator.leave(child);
<add> expect(child.attr('class')).toContain('custom-leave-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(child.attr('class')).toContain('custom-leave-start');
<add> window.setTimeout.expect(0).process();
<add> }));
<add> });
<add>
<add> it("should throw an error when an invalid ng-animate syntax is provided", inject(function($compile, $rootScope) {
<add> expect(function() {
<add> element = $compile('<div ng-repeat="i in is" ng-animate=":"></div>')($rootScope);
<add> }).toThrow("Syntax Error: Token ':' not a primary expression at column 1 of the expression [:] starting at [:].");
<add> }));
<add>});
<ide><path>test/ng/directive/ngIncludeSpec.js
<ide> describe('ngInclude', function() {
<ide> }));
<ide> });
<ide> });
<add>
<add>describe('ngInclude ngAnimate', function() {
<add> var element, vendorPrefix, window;
<add>
<add> beforeEach(module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> return function($sniffer) {
<add> vendorPrefix = '-' + $sniffer.vendorPrefix + '-';
<add> };
<add> }));
<add>
<add> afterEach(function(){
<add> dealoc(element);
<add> });
<add>
<add> it('should fire off the enter animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $templateCache, $sniffer) {
<add>
<add> $templateCache.put('enter', [200, '<div>data</div>', {}]);
<add> $rootScope.tpl = 'enter';
<add> element = $compile(
<add> '<div ' +
<add> 'ng-include="tpl" ' +
<add> 'ng-animate="{enter: \'custom-enter\'}">' +
<add> '</div>'
<add> )($rootScope);
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = vendorPrefix + 'transition';
<add> var cssValue = '1s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(child.attr('class')).toContain('custom-enter-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(child.attr('class')).toContain('custom-enter-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(child.attr('class')).not.toContain('custom-enter-setup');
<add> expect(child.attr('class')).not.toContain('custom-enter-start');
<add> }));
<add>
<add> it('should fire off the leave animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $templateCache, $sniffer) {
<add> $templateCache.put('enter', [200, '<div>data</div>', {}]);
<add> $rootScope.tpl = 'enter';
<add> element = $compile(
<add> '<div ' +
<add> 'ng-include="tpl" ' +
<add> 'ng-animate="{leave: \'custom-leave\'}">' +
<add> '</div>'
<add> )($rootScope);
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = vendorPrefix + 'transition';
<add> var cssValue = '1s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> $rootScope.tpl = '';
<add> $rootScope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(child.attr('class')).toContain('custom-leave-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(child.attr('class')).toContain('custom-leave-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(child.attr('class')).not.toContain('custom-leave-setup');
<add> expect(child.attr('class')).not.toContain('custom-leave-start');
<add> }));
<add>
<add> it('should catch and use the correct duration for animation',
<add> inject(function($compile, $rootScope, $templateCache, $sniffer) {
<add> $templateCache.put('enter', [200, '<div>data</div>', {}]);
<add> $rootScope.tpl = 'enter';
<add> element = $compile(
<add> '<div ' +
<add> 'ng-include="tpl" ' +
<add> 'ng-animate="{enter: \'custom-enter\'}">' +
<add> '</div>'
<add> )($rootScope);
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = vendorPrefix + 'transition';
<add> var cssValue = '0.5s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> $rootScope.tpl = 'enter';
<add> $rootScope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(500).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add> }));
<add>
<add>});
<ide><path>test/ng/directive/ngRepeatSpec.js
<ide> describe('ngRepeat', function() {
<ide>
<ide> element = $compile(
<ide> '<ul>' +
<del> '<li ng-repeat="(key, value) in items track by $index">' +
<add> '<li ng-repeat="(key, value) in items track by $index">' +
<ide> '{{key}}:{{value}};' +
<ide> '<input type="checkbox" ng-model="items[key]">' +
<del> '</li>' +
<del> '</ul>')(scope);
<add> '</li>' +
<add> '</ul>')(scope);
<ide>
<ide> scope.items = {misko: true, shyam: true, zhenbo:true};
<ide> scope.$digest();
<ide> describe('ngRepeat', function() {
<ide> });
<ide>
<ide>
<add> it('should preserve data on move of elements', function() {
<add> element = $compile('<ul><li ng-repeat="item in array">{{item}}|</li></ul>')(scope);
<add> scope.array = ['a', 'b'];
<add> scope.$digest();
<add>
<add> var lis = element.find('li');
<add> lis.eq(0).data('mark', 'a');
<add> lis.eq(1).data('mark', 'b');
<add>
<add> scope.array = ['b', 'a'];
<add> scope.$digest();
<add>
<add> var lis = element.find('li');
<add> expect(lis.eq(0).data('mark')).toEqual('b');
<add> expect(lis.eq(1).data('mark')).toEqual('a');
<add> });
<add>
<add>
<ide> describe('stability', function() {
<ide> var a, b, c, d, lis;
<ide>
<ide> describe('ngRepeat', function() {
<ide> scope.items = ['hello', 'cau', 'ahoj'];
<ide> scope.$digest();
<ide> lis = element.find('li');
<add> lis[2].id = 'yes';
<ide>
<ide> scope.items = ['ahoj', 'hello', 'cau'];
<ide> scope.$digest();
<ide> describe('ngRepeat', function() {
<ide> });
<ide> });
<ide> });
<add>
<add>describe('ngRepeat ngAnimate', function() {
<add> var element, vendorPrefix, window;
<add>
<add> beforeEach(module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> return function($sniffer) {
<add> vendorPrefix = '-' + $sniffer.vendorPrefix + '-';
<add> };
<add> }));
<add>
<add> afterEach(function(){
<add> dealoc(element);
<add> });
<add>
<add> it('should fire off the enter animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $sniffer) {
<add>
<add> element = $compile(
<add> '<div><div ' +
<add> 'ng-repeat="item in items" ' +
<add> 'ng-animate="{enter: \'custom-enter\'}">' +
<add> '{{ item }}' +
<add> '</div></div>'
<add> )($rootScope);
<add>
<add> $rootScope.items = ['1','2','3'];
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var cssProp = vendorPrefix + 'transition';
<add> var cssValue = '1s linear all';
<add> var kids = element.children();
<add> for(var i=0;i<kids.length;i++) {
<add> kids[i] = jqLite(kids[i]);
<add> kids[i].css(cssProp, cssValue);
<add> }
<add>
<add> if ($sniffer.supportsTransitions) {
<add> angular.forEach(kids, function(kid) {
<add> expect(kid.attr('class')).toContain('custom-enter-setup');
<add> window.setTimeout.expect(1).process();
<add> });
<add>
<add> angular.forEach(kids, function(kid) {
<add> expect(kid.attr('class')).toContain('custom-enter-start');
<add> window.setTimeout.expect(1000).process();
<add> });
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> angular.forEach(kids, function(kid) {
<add> expect(kid.attr('class')).not.toContain('custom-enter-setup');
<add> expect(kid.attr('class')).not.toContain('custom-enter-start');
<add> });
<add> }));
<add>
<add> it('should fire off the leave animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $sniffer) {
<add>
<add> element = $compile(
<add> '<div><div ' +
<add> 'ng-repeat="item in items" ' +
<add> 'ng-animate="{leave: \'custom-leave\'}">' +
<add> '{{ item }}' +
<add> '</div></div>'
<add> )($rootScope);
<add>
<add> $rootScope.items = ['1','2','3'];
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var cssProp = vendorPrefix + 'transition';
<add> var cssValue = '1s linear all';
<add> var kids = element.children();
<add> for(var i=0;i<kids.length;i++) {
<add> kids[i] = jqLite(kids[i]);
<add> kids[i].css(cssProp, cssValue);
<add> }
<add>
<add> $rootScope.items = ['1','3'];
<add> $rootScope.$digest();
<add>
<add> //the last element gets pushed down when it animates
<add> var kid = jqLite(element.children()[1]);
<add> if ($sniffer.supportsTransitions) {
<add> expect(kid.attr('class')).toContain('custom-leave-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(kid.attr('class')).toContain('custom-leave-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(kid.attr('class')).not.toContain('custom-leave-setup');
<add> expect(kid.attr('class')).not.toContain('custom-leave-start');
<add> }));
<add>
<add> it('should fire off the move animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $sniffer) {
<add> element = $compile(
<add> '<div>' +
<add> '<div ng-repeat="item in items" ng-animate="{move: \'custom-move\'}">' +
<add> '{{ item }}' +
<add> '</div>' +
<add> '</div>'
<add> )($rootScope);
<add>
<add> $rootScope.items = ['1','2','3'];
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var cssProp = '-' + $sniffer.vendorPrefix + '-transition';
<add> var cssValue = '1s linear all';
<add> var kids = element.children();
<add> for(var i=0;i<kids.length;i++) {
<add> kids[i] = jqLite(kids[i]);
<add> kids[i].css(cssProp, cssValue);
<add> }
<add>
<add> $rootScope.items = ['2','3','1'];
<add> $rootScope.$digest();
<add>
<add> //the last element gets pushed down when it animates
<add> var kids = element.children();
<add> var first = jqLite(kids[0]);
<add> var left = jqLite(kids[1]);
<add> var right = jqLite(kids[2]);
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(first.attr('class')).toContain('custom-move-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(left.attr('class')).toContain('custom-move-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(first.attr('class')).toContain('custom-move-start');
<add> window.setTimeout.expect(1000).process();
<add> expect(left.attr('class')).toContain('custom-move-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(first.attr('class')).not.toContain('custom-move-setup');
<add> expect(first.attr('class')).not.toContain('custom-move-start');
<add> expect(left.attr('class')).not.toContain('custom-move-setup');
<add> expect(left.attr('class')).not.toContain('custom-move-start');
<add> expect(right.attr('class')).not.toContain('custom-move-setup');
<add> expect(right.attr('class')).not.toContain('custom-move-start');
<add> }));
<add>
<add> it('should catch and use the correct duration for animation',
<add> inject(function($compile, $rootScope, $sniffer) {
<add>
<add> element = $compile(
<add> '<div><div ' +
<add> 'ng-repeat="item in items" ' +
<add> 'ng-animate="{enter: \'custom-enter\'}">' +
<add> '{{ item }}' +
<add> '</div></div>'
<add> )($rootScope);
<add>
<add> $rootScope.items = ['a','b'];
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var kids = element.children();
<add> var first = jqLite(kids[0]);
<add> var second = jqLite(kids[1]);
<add> var cssProp = '-' + $sniffer.vendorPrefix + '-transition';
<add> var cssValue = '0.5s linear all';
<add> first.css(cssProp, cssValue);
<add> second.css(cssProp, cssValue);
<add>
<add> if ($sniffer.supportsTransitions) {
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(500).process();
<add> window.setTimeout.expect(500).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add> }));
<add>
<add>});
<ide><path>test/ng/directive/ngShowHideSpec.js
<ide> describe('ngShow / ngHide', function() {
<ide> }));
<ide> });
<ide> });
<add>
<add>describe('ngShow / ngHide - ngAnimate', function() {
<add> var element, window;
<add> var vendorPrefix;
<add>
<add> beforeEach(module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> return function($sniffer) {
<add> vendorPrefix = '-' + $sniffer.vendorPrefix + '-';
<add> };
<add> }));
<add>
<add> afterEach(function() {
<add> dealoc(element);
<add> });
<add>
<add> describe('ngShow', function() {
<add> it('should fire off the animator.show and animator.hide animation', inject(function($compile, $rootScope, $sniffer) {
<add> var $scope = $rootScope.$new();
<add> $scope.on = true;
<add> element = $compile(
<add> '<div ' +
<add> 'style="'+vendorPrefix+'transition: 1s linear all"' +
<add> 'ng-show="on" ' +
<add> 'ng-animate="{show: \'custom-show\', hide: \'custom-hide\'}">' +
<add> '</div>'
<add> )($scope);
<add> $scope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(element.attr('class')).toContain('custom-show-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(element.attr('class')).toContain('custom-show-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(element.attr('class')).not.toContain('custom-show-start');
<add> expect(element.attr('class')).not.toContain('custom-show-setup');
<add>
<add> $scope.on = false;
<add> $scope.$digest();
<add> if ($sniffer.supportsTransitions) {
<add> expect(element.attr('class')).toContain('custom-hide-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(element.attr('class')).toContain('custom-hide-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(element.attr('class')).not.toContain('custom-hide-start');
<add> expect(element.attr('class')).not.toContain('custom-hide-setup');
<add> }));
<add> });
<add>
<add> describe('ngHide', function() {
<add> it('should fire off the animator.show and animator.hide animation', inject(function($compile, $rootScope, $sniffer) {
<add> var $scope = $rootScope.$new();
<add> $scope.off = true;
<add> element = $compile(
<add> '<div ' +
<add> 'style="'+vendorPrefix+'transition: 1s linear all"' +
<add> 'ng-hide="off" ' +
<add> 'ng-animate="{show: \'custom-show\', hide: \'custom-hide\'}">' +
<add> '</div>'
<add> )($scope);
<add> $scope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(element.attr('class')).toContain('custom-hide-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(element.attr('class')).toContain('custom-hide-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(element.attr('class')).not.toContain('custom-hide-start');
<add> expect(element.attr('class')).not.toContain('custom-hide-setup');
<add>
<add> $scope.off = false;
<add> $scope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(element.attr('class')).toContain('custom-show-setup');
<add> window.setTimeout.expect(1).process();
<add> expect(element.attr('class')).toContain('custom-show-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(element.attr('class')).not.toContain('custom-show-start');
<add> expect(element.attr('class')).not.toContain('custom-show-setup');
<add> }));
<add> });
<add>});
<ide><path>test/ng/directive/ngSwitchSpec.js
<ide> describe('ngSwitch', function() {
<ide> // afterwards a global afterEach will check for leaks in jq data cache object
<ide> }));
<ide> });
<add>
<add>describe('ngSwitch ngAnimate', function() {
<add> var element, vendorPrefix, window;
<add>
<add> beforeEach(module(function($animationProvider, $provide) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> return function($sniffer) {
<add> vendorPrefix = '-' + $sniffer.vendorPrefix + '-';
<add> };
<add> }));
<add>
<add> afterEach(function(){
<add> dealoc(element);
<add> });
<add>
<add> it('should fire off the enter animation + set and remove the classes',
<add> inject(function($compile, $rootScope, $sniffer) {
<add> var $scope = $rootScope.$new();
<add> var style = vendorPrefix + 'transition: 1s linear all';
<add> element = $compile(
<add> '<div ng-switch on="val" ng-animate="{enter: \'cool-enter\', leave: \'cool-leave\'}">' +
<add> '<div ng-switch-when="one" style="' + style + '">one</div>' +
<add> '<div ng-switch-when="two" style="' + style + '">two</div>' +
<add> '<div ng-switch-when="three" style="' + style + '">three</div>' +
<add> '</div>'
<add> )($scope);
<add>
<add> $scope.val = 'one';
<add> $scope.$digest();
<add>
<add> expect(element.children().length).toBe(1);
<add> var first = element.children()[0];
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(first.className).toContain('cool-enter-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(first.className).toContain('cool-enter-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(first.className).not.toContain('cool-enter-setup');
<add> expect(first.className).not.toContain('cool-enter-start');
<add> }));
<add>
<add>
<add> it('should fire off the leave animation + set and remove the classes',
<add> inject(function($compile, $rootScope, $sniffer) {
<add> var $scope = $rootScope.$new();
<add> var style = vendorPrefix + 'transition: 1s linear all';
<add> element = $compile(
<add> '<div ng-switch on="val" ng-animate="{enter: \'cool-enter\', leave: \'cool-leave\'}">' +
<add> '<div ng-switch-when="one" style="' + style + '">one</div>' +
<add> '<div ng-switch-when="two" style="' + style + '">two</div>' +
<add> '<div ng-switch-when="three" style="' + style + '">three</div>' +
<add> '</div>'
<add> )($scope);
<add>
<add> $scope.val = 'two';
<add> $scope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> $scope.val = 'three';
<add> $scope.$digest();
<add>
<add> expect(element.children().length).toBe($sniffer.supportsTransitions ? 2 : 1);
<add> var first = element.children()[0];
<add>
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(first.className).toContain('cool-leave-setup');
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(1).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(first.className).toContain('cool-leave-start');
<add> window.setTimeout.expect(1000).process();
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(first.className).not.toContain('cool-leave-setup');
<add> expect(first.className).not.toContain('cool-leave-start');
<add> }));
<add>
<add> it('should catch and use the correct duration for animation',
<add> inject(function($compile, $rootScope, $sniffer) {
<add> element = $compile(
<add> '<div ng-switch on="val" ng-animate="{enter: \'cool-enter\', leave: \'cool-leave\'}">' +
<add> '<div ng-switch-when="one" style="' + vendorPrefix + 'transition: 0.5s linear all">one</div>' +
<add> '</div>'
<add> )($rootScope);
<add>
<add> $rootScope.val = 'one';
<add> $rootScope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect(500).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add> }));
<add>
<add>});
<ide><path>test/ng/directive/ngViewSpec.js
<ide> describe('ngView', function() {
<ide> $rootScope.$digest();
<ide>
<ide> forEach(element.contents(), function(node) {
<del> if ( node.nodeType == 3 ) {
<add> if ( node.nodeType == 3 /* text node */) {
<ide> expect(jqLite(node).scope()).not.toBe($route.current.scope);
<ide> expect(jqLite(node).controller()).not.toBeDefined();
<ide> } else {
<ide> describe('ngView', function() {
<ide> });
<ide> });
<ide> });
<add>
<add>describe('ngAnimate', function() {
<add> var element, window;
<add>
<add> beforeEach(module(function($provide, $routeProvider) {
<add> $provide.value('$window', window = angular.mock.createMockWindow());
<add> $routeProvider.when('/foo', {controller: noop, templateUrl: '/foo.html'});
<add> return function($templateCache) {
<add> $templateCache.put('/foo.html', [200, '<div>data</div>', {}]);
<add> }
<add> }));
<add>
<add> afterEach(function(){
<add> dealoc(element);
<add> });
<add>
<add> it('should fire off the enter animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
<add> element = $compile('<div ng-view ng-animate="{enter: \'custom-enter\'}"></div>')($rootScope);
<add>
<add> $location.path('/foo');
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = '-' + $sniffer.vendorPrefix + '-transition';
<add> var cssValue = '1s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(child.attr('class')).toContain('custom-enter-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(child.attr('class')).toContain('custom-enter-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(child.attr('class')).not.toContain('custom-enter-setup');
<add> expect(child.attr('class')).not.toContain('custom-enter-start');
<add> }));
<add>
<add> it('should fire off the leave animation + add and remove the css classes',
<add> inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
<add> $templateCache.put('/foo.html', [200, '<div>foo</div>', {}]);
<add> element = $compile('<div ng-view ng-animate="{leave: \'custom-leave\'}"></div>')($rootScope);
<add>
<add> $location.path('/foo');
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = '-' + $sniffer.vendorPrefix + '-transition';
<add> var cssValue = '1s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> $location.path('/');
<add> $rootScope.$digest();
<add>
<add> if ($sniffer.supportsTransitions) {
<add> expect(child.attr('class')).toContain('custom-leave-setup');
<add> window.setTimeout.expect(1).process();
<add>
<add> expect(child.attr('class')).toContain('custom-leave-start');
<add> window.setTimeout.expect(1000).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add>
<add> expect(child.attr('class')).not.toContain('custom-leave-setup');
<add> expect(child.attr('class')).not.toContain('custom-leave-start');
<add> }));
<add>
<add> it('should catch and use the correct duration for animations',
<add> inject(function($compile, $rootScope, $sniffer, $location, $templateCache) {
<add> $templateCache.put('/foo.html', [200, '<div>foo</div>', {}]);
<add> element = $compile(
<add> '<div ' +
<add> 'ng-view ' +
<add> 'ng-animate="{enter: \'customEnter\'}">' +
<add> '</div>'
<add> )($rootScope);
<add>
<add> $location.path('/foo');
<add> $rootScope.$digest();
<add>
<add> //if we add the custom css stuff here then it will get picked up before the animation takes place
<add> var child = jqLite(element.children()[0]);
<add> var cssProp = '-' + $sniffer.vendorPrefix + '-transition';
<add> var cssValue = '0.5s linear all';
<add> child.css(cssProp, cssValue);
<add>
<add> if($sniffer.supportsTransitions) {
<add> window.setTimeout.expect(1).process();
<add> window.setTimeout.expect($sniffer.supportsTransitions ? 500 : 0).process();
<add> } else {
<add> expect(window.setTimeout.queue).toEqual([]);
<add> }
<add> }));
<add>
<add>});
<ide><path>test/ng/snifferSpec.js
<ide> describe('$sniffer', function() {
<ide> function sniffer($window, $document) {
<ide> $window.navigator = {};
<ide> $document = jqLite($document || {});
<add> if (!$document[0].body) {
<add> $document[0].body = window.document.body;
<add> }
<ide> return new $SnifferProvider().$get[2]($window, $document);
<ide> }
<ide>
<ide> describe('$sniffer', function() {
<ide>
<ide> describe('hashchange', function() {
<ide> it('should be true if onhashchange property defined', function() {
<del> expect(sniffer({onhashchange: true}, {}).hashchange).toBe(true);
<add> expect(sniffer({onhashchange: true}).hashchange).toBe(true);
<ide> });
<ide>
<ide> it('should be false if onhashchange property not defined', function() {
<del> expect(sniffer({}, {}).hashchange).toBe(false);
<add> expect(sniffer({}).hashchange).toBe(false);
<ide> });
<ide>
<ide> it('should be false if documentMode is 7 (IE8 comp mode)', function() {
<ide> describe('$sniffer', function() {
<ide>
<ide> describe('csp', function() {
<ide> it('should be false if document.securityPolicy.isActive not available', function() {
<del> expect(sniffer({}, {}).csp).toBe(false);
<add> expect(sniffer({}).csp).toBe(false);
<ide> });
<ide>
<ide>
<ide> describe('$sniffer', function() {
<ide> expect(sniffer({}, createDocumentWithCSP(true)).csp).toBe(true);
<ide> });
<ide> });
<add>
<add> describe('vendorPrefix', function() {
<add>
<add> it('should return the correct vendor prefix based on the browser', function() {
<add> inject(function($sniffer, $window) {
<add> var expectedPrefix;
<add> var ua = $window.navigator.userAgent.toLowerCase();
<add> if(/chrome/i.test(ua) || /safari/i.test(ua) || /webkit/i.test(ua)) {
<add> expectedPrefix = 'Webkit';
<add> }
<add> else if(/firefox/i.test(ua)) {
<add> expectedPrefix = 'Moz';
<add> }
<add> else if(/ie/i.test(ua)) {
<add> expectedPrefix = 'Ms';
<add> }
<add> else if(/opera/i.test(ua)) {
<add> expectedPrefix = 'O';
<add> }
<add> expect($sniffer.vendorPrefix).toBe(expectedPrefix);
<add> });
<add> });
<add>
<add> });
<add>
<add> describe('supportsTransitions', function() {
<add>
<add> it('should be either true or false', function() {
<add> inject(function($sniffer) {
<add> expect($sniffer.supportsTransitions).not.toBe(undefined);
<add> });
<add> });
<add>
<add> });
<ide> }); | 25 |
Ruby | Ruby | fix deprecation message on info screen | d283ca34a95fddc5d7e982432e0b5ea61269c133 | <ide><path>railties/lib/rails/info.rb
<ide> def to_html
<ide> end
<ide>
<ide> property 'Middleware' do
<del> Rails.configuration.middleware.active.map(&:inspect)
<add> Rails.configuration.middleware.map(&:inspect)
<ide> end
<ide>
<ide> # The application's location on the filesystem. | 1 |
Mixed | Ruby | use fixed fonts only in the name of the parameter | 7814f901e1ec0cc3228914f60bd340922f98d94f | <ide><path>actionpack/lib/action_controller/test_case.rb
<ide> def determine_default_controller_class(name)
<ide> # Simulate a GET request with the given parameters.
<ide> #
<ide> # - +action+: The controller action to call.
<del> # - +params:+ The hash with HTTP parameters that you want to pass. This may be +nil+.
<del> # - +body:+ The request body with a string that is appropriately encoded
<add> # - +params+: The hash with HTTP parameters that you want to pass. This may be +nil+.
<add> # - +body+: The request body with a string that is appropriately encoded
<ide> # (<tt>application/x-www-form-urlencoded</tt> or <tt>multipart/form-data</tt>).
<del> # - +session:+ A hash of parameters to store in the session. This may be +nil+.
<del> # - +flash:+ A hash of parameters to store in the flash. This may be +nil+.
<add> # - +session+: A hash of parameters to store in the session. This may be +nil+.
<add> # - +flash+: A hash of parameters to store in the flash. This may be +nil+.
<ide> #
<ide> # You can also simulate POST, PATCH, PUT, DELETE, and HEAD requests with
<ide> # +post+, +patch+, +put+, +delete+, and +head+.
<ide> def paramify_values(hash_or_array_or_value)
<ide> # - +action+: The controller action to call.
<ide> # - +method+: Request method used to send the HTTP request. Possible values
<ide> # are +GET+, +POST+, +PATCH+, +PUT+, +DELETE+, +HEAD+. Defaults to +GET+. Can be a symbol.
<del> # - +params:+ The hash with HTTP parameters that you want to pass. This may be +nil+.
<del> # - +body:+ The request body with a string that is appropriately encoded
<add> # - +params+: The hash with HTTP parameters that you want to pass. This may be +nil+.
<add> # - +body+: The request body with a string that is appropriately encoded
<ide> # (<tt>application/x-www-form-urlencoded</tt> or <tt>multipart/form-data</tt>).
<del> # - +session:+ A hash of parameters to store in the session. This may be +nil+.
<del> # - +flash:+ A hash of parameters to store in the flash. This may be +nil+.
<add> # - +session+: A hash of parameters to store in the session. This may be +nil+.
<add> # - +flash+: A hash of parameters to store in the flash. This may be +nil+.
<ide> #
<ide> # Example calling +create+ action and sending two params:
<ide> #
<ide><path>actionpack/lib/action_dispatch/testing/integration.rb
<ide> module RequestHelpers
<ide> #
<ide> # - +path+: The URI (as a String) on which you want to perform a GET
<ide> # request.
<del> # - +params:+ The HTTP parameters that you want to pass. This may
<add> # - +params+: The HTTP parameters that you want to pass. This may
<ide> # be +nil+,
<ide> # a Hash, or a String that is appropriately encoded
<ide> # (<tt>application/x-www-form-urlencoded</tt> or
<ide> # <tt>multipart/form-data</tt>).
<del> # - +headers:+ Additional headers to pass, as a Hash. The headers will be
<add> # - +headers+: Additional headers to pass, as a Hash. The headers will be
<ide> # merged into the Rack env hash.
<del> # - +env:+ Additional env to pass, as a Hash. The headers will be
<add> # - +env+: Additional env to pass, as a Hash. The headers will be
<ide> # merged into the Rack env hash.
<ide> #
<ide> # This method returns a Response object, which one can use to
<ide><path>guides/source/testing.md
<ide> The `get` method kicks off the web request and populates the results into the re
<ide> * The action of the controller you are requesting.
<ide> This can be in the form of a string or a symbol.
<ide>
<del>* `params:` option with a hash of request parameters to pass into the action
<add>* `params`: option with a hash of request parameters to pass into the action
<ide> (e.g. query string parameters or article variables).
<ide>
<del>* `session:` option with a hash of session variables to pass along with the request.
<add>* `session`: option with a hash of session variables to pass along with the request.
<ide>
<del>* `flash:` option with a hash of flash values.
<add>* `flash`: option with a hash of flash values.
<ide>
<ide> All the keyword arguments are optional.
<ide> | 3 |
Javascript | Javascript | add dat.gui module | 53471122b49e92f301656c7b6274af224e61866c | <ide><path>3rdparty/dat.gui.module.js
<add>/**
<add> * dat-gui JavaScript Controller Library
<add> * http://code.google.com/p/dat-gui
<add> *
<add> * Copyright 2011 Data Arts Team, Google Creative Lab
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> */
<add>
<add>function ___$insertStyle(css) {
<add> if (!css) {
<add> return;
<add> }
<add> if (typeof window === 'undefined') {
<add> return;
<add> }
<add>
<add> var style = document.createElement('style');
<add>
<add> style.setAttribute('type', 'text/css');
<add> style.innerHTML = css;
<add> document.head.appendChild(style);
<add>
<add> return css;
<add>}
<add>
<add>function colorToString (color, forceCSSHex) {
<add> var colorFormat = color.__state.conversionName.toString();
<add> var r = Math.round(color.r);
<add> var g = Math.round(color.g);
<add> var b = Math.round(color.b);
<add> var a = color.a;
<add> var h = Math.round(color.h);
<add> var s = color.s.toFixed(1);
<add> var v = color.v.toFixed(1);
<add> if (forceCSSHex || colorFormat === 'THREE_CHAR_HEX' || colorFormat === 'SIX_CHAR_HEX') {
<add> var str = color.hex.toString(16);
<add> while (str.length < 6) {
<add> str = '0' + str;
<add> }
<add> return '#' + str;
<add> } else if (colorFormat === 'CSS_RGB') {
<add> return 'rgb(' + r + ',' + g + ',' + b + ')';
<add> } else if (colorFormat === 'CSS_RGBA') {
<add> return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
<add> } else if (colorFormat === 'HEX') {
<add> return '0x' + color.hex.toString(16);
<add> } else if (colorFormat === 'RGB_ARRAY') {
<add> return '[' + r + ',' + g + ',' + b + ']';
<add> } else if (colorFormat === 'RGBA_ARRAY') {
<add> return '[' + r + ',' + g + ',' + b + ',' + a + ']';
<add> } else if (colorFormat === 'RGB_OBJ') {
<add> return '{r:' + r + ',g:' + g + ',b:' + b + '}';
<add> } else if (colorFormat === 'RGBA_OBJ') {
<add> return '{r:' + r + ',g:' + g + ',b:' + b + ',a:' + a + '}';
<add> } else if (colorFormat === 'HSV_OBJ') {
<add> return '{h:' + h + ',s:' + s + ',v:' + v + '}';
<add> } else if (colorFormat === 'HSVA_OBJ') {
<add> return '{h:' + h + ',s:' + s + ',v:' + v + ',a:' + a + '}';
<add> }
<add> return 'unknown format';
<add>}
<add>
<add>var ARR_EACH = Array.prototype.forEach;
<add>var ARR_SLICE = Array.prototype.slice;
<add>var Common = {
<add> BREAK: {},
<add> extend: function extend(target) {
<add> this.each(ARR_SLICE.call(arguments, 1), function (obj) {
<add> var keys = this.isObject(obj) ? Object.keys(obj) : [];
<add> keys.forEach(function (key) {
<add> if (!this.isUndefined(obj[key])) {
<add> target[key] = obj[key];
<add> }
<add> }.bind(this));
<add> }, this);
<add> return target;
<add> },
<add> defaults: function defaults(target) {
<add> this.each(ARR_SLICE.call(arguments, 1), function (obj) {
<add> var keys = this.isObject(obj) ? Object.keys(obj) : [];
<add> keys.forEach(function (key) {
<add> if (this.isUndefined(target[key])) {
<add> target[key] = obj[key];
<add> }
<add> }.bind(this));
<add> }, this);
<add> return target;
<add> },
<add> compose: function compose() {
<add> var toCall = ARR_SLICE.call(arguments);
<add> return function () {
<add> var args = ARR_SLICE.call(arguments);
<add> for (var i = toCall.length - 1; i >= 0; i--) {
<add> args = [toCall[i].apply(this, args)];
<add> }
<add> return args[0];
<add> };
<add> },
<add> each: function each(obj, itr, scope) {
<add> if (!obj) {
<add> return;
<add> }
<add> if (ARR_EACH && obj.forEach && obj.forEach === ARR_EACH) {
<add> obj.forEach(itr, scope);
<add> } else if (obj.length === obj.length + 0) {
<add> var key = void 0;
<add> var l = void 0;
<add> for (key = 0, l = obj.length; key < l; key++) {
<add> if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) {
<add> return;
<add> }
<add> }
<add> } else {
<add> for (var _key in obj) {
<add> if (itr.call(scope, obj[_key], _key) === this.BREAK) {
<add> return;
<add> }
<add> }
<add> }
<add> },
<add> defer: function defer(fnc) {
<add> setTimeout(fnc, 0);
<add> },
<add> debounce: function debounce(func, threshold, callImmediately) {
<add> var timeout = void 0;
<add> return function () {
<add> var obj = this;
<add> var args = arguments;
<add> function delayed() {
<add> timeout = null;
<add> if (!callImmediately) func.apply(obj, args);
<add> }
<add> var callNow = callImmediately || !timeout;
<add> clearTimeout(timeout);
<add> timeout = setTimeout(delayed, threshold);
<add> if (callNow) {
<add> func.apply(obj, args);
<add> }
<add> };
<add> },
<add> toArray: function toArray(obj) {
<add> if (obj.toArray) return obj.toArray();
<add> return ARR_SLICE.call(obj);
<add> },
<add> isUndefined: function isUndefined(obj) {
<add> return obj === undefined;
<add> },
<add> isNull: function isNull(obj) {
<add> return obj === null;
<add> },
<add> isNaN: function (_isNaN) {
<add> function isNaN(_x) {
<add> return _isNaN.apply(this, arguments);
<add> }
<add> isNaN.toString = function () {
<add> return _isNaN.toString();
<add> };
<add> return isNaN;
<add> }(function (obj) {
<add> return isNaN(obj);
<add> }),
<add> isArray: Array.isArray || function (obj) {
<add> return obj.constructor === Array;
<add> },
<add> isObject: function isObject(obj) {
<add> return obj === Object(obj);
<add> },
<add> isNumber: function isNumber(obj) {
<add> return obj === obj + 0;
<add> },
<add> isString: function isString(obj) {
<add> return obj === obj + '';
<add> },
<add> isBoolean: function isBoolean(obj) {
<add> return obj === false || obj === true;
<add> },
<add> isFunction: function isFunction(obj) {
<add> return Object.prototype.toString.call(obj) === '[object Function]';
<add> }
<add>};
<add>
<add>var INTERPRETATIONS = [
<add>{
<add> litmus: Common.isString,
<add> conversions: {
<add> THREE_CHAR_HEX: {
<add> read: function read(original) {
<add> var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
<add> if (test === null) {
<add> return false;
<add> }
<add> return {
<add> space: 'HEX',
<add> hex: parseInt('0x' + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + test[3].toString() + test[3].toString(), 0)
<add> };
<add> },
<add> write: colorToString
<add> },
<add> SIX_CHAR_HEX: {
<add> read: function read(original) {
<add> var test = original.match(/^#([A-F0-9]{6})$/i);
<add> if (test === null) {
<add> return false;
<add> }
<add> return {
<add> space: 'HEX',
<add> hex: parseInt('0x' + test[1].toString(), 0)
<add> };
<add> },
<add> write: colorToString
<add> },
<add> CSS_RGB: {
<add> read: function read(original) {
<add> var test = original.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
<add> if (test === null) {
<add> return false;
<add> }
<add> return {
<add> space: 'RGB',
<add> r: parseFloat(test[1]),
<add> g: parseFloat(test[2]),
<add> b: parseFloat(test[3])
<add> };
<add> },
<add> write: colorToString
<add> },
<add> CSS_RGBA: {
<add> read: function read(original) {
<add> var test = original.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
<add> if (test === null) {
<add> return false;
<add> }
<add> return {
<add> space: 'RGB',
<add> r: parseFloat(test[1]),
<add> g: parseFloat(test[2]),
<add> b: parseFloat(test[3]),
<add> a: parseFloat(test[4])
<add> };
<add> },
<add> write: colorToString
<add> }
<add> }
<add>},
<add>{
<add> litmus: Common.isNumber,
<add> conversions: {
<add> HEX: {
<add> read: function read(original) {
<add> return {
<add> space: 'HEX',
<add> hex: original,
<add> conversionName: 'HEX'
<add> };
<add> },
<add> write: function write(color) {
<add> return color.hex;
<add> }
<add> }
<add> }
<add>},
<add>{
<add> litmus: Common.isArray,
<add> conversions: {
<add> RGB_ARRAY: {
<add> read: function read(original) {
<add> if (original.length !== 3) {
<add> return false;
<add> }
<add> return {
<add> space: 'RGB',
<add> r: original[0],
<add> g: original[1],
<add> b: original[2]
<add> };
<add> },
<add> write: function write(color) {
<add> return [color.r, color.g, color.b];
<add> }
<add> },
<add> RGBA_ARRAY: {
<add> read: function read(original) {
<add> if (original.length !== 4) return false;
<add> return {
<add> space: 'RGB',
<add> r: original[0],
<add> g: original[1],
<add> b: original[2],
<add> a: original[3]
<add> };
<add> },
<add> write: function write(color) {
<add> return [color.r, color.g, color.b, color.a];
<add> }
<add> }
<add> }
<add>},
<add>{
<add> litmus: Common.isObject,
<add> conversions: {
<add> RGBA_OBJ: {
<add> read: function read(original) {
<add> if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b) && Common.isNumber(original.a)) {
<add> return {
<add> space: 'RGB',
<add> r: original.r,
<add> g: original.g,
<add> b: original.b,
<add> a: original.a
<add> };
<add> }
<add> return false;
<add> },
<add> write: function write(color) {
<add> return {
<add> r: color.r,
<add> g: color.g,
<add> b: color.b,
<add> a: color.a
<add> };
<add> }
<add> },
<add> RGB_OBJ: {
<add> read: function read(original) {
<add> if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b)) {
<add> return {
<add> space: 'RGB',
<add> r: original.r,
<add> g: original.g,
<add> b: original.b
<add> };
<add> }
<add> return false;
<add> },
<add> write: function write(color) {
<add> return {
<add> r: color.r,
<add> g: color.g,
<add> b: color.b
<add> };
<add> }
<add> },
<add> HSVA_OBJ: {
<add> read: function read(original) {
<add> if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v) && Common.isNumber(original.a)) {
<add> return {
<add> space: 'HSV',
<add> h: original.h,
<add> s: original.s,
<add> v: original.v,
<add> a: original.a
<add> };
<add> }
<add> return false;
<add> },
<add> write: function write(color) {
<add> return {
<add> h: color.h,
<add> s: color.s,
<add> v: color.v,
<add> a: color.a
<add> };
<add> }
<add> },
<add> HSV_OBJ: {
<add> read: function read(original) {
<add> if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v)) {
<add> return {
<add> space: 'HSV',
<add> h: original.h,
<add> s: original.s,
<add> v: original.v
<add> };
<add> }
<add> return false;
<add> },
<add> write: function write(color) {
<add> return {
<add> h: color.h,
<add> s: color.s,
<add> v: color.v
<add> };
<add> }
<add> }
<add> }
<add>}];
<add>var result = void 0;
<add>var toReturn = void 0;
<add>var interpret = function interpret() {
<add> toReturn = false;
<add> var original = arguments.length > 1 ? Common.toArray(arguments) : arguments[0];
<add> Common.each(INTERPRETATIONS, function (family) {
<add> if (family.litmus(original)) {
<add> Common.each(family.conversions, function (conversion, conversionName) {
<add> result = conversion.read(original);
<add> if (toReturn === false && result !== false) {
<add> toReturn = result;
<add> result.conversionName = conversionName;
<add> result.conversion = conversion;
<add> return Common.BREAK;
<add> }
<add> });
<add> return Common.BREAK;
<add> }
<add> });
<add> return toReturn;
<add>};
<add>
<add>var tmpComponent = void 0;
<add>var ColorMath = {
<add> hsv_to_rgb: function hsv_to_rgb(h, s, v) {
<add> var hi = Math.floor(h / 60) % 6;
<add> var f = h / 60 - Math.floor(h / 60);
<add> var p = v * (1.0 - s);
<add> var q = v * (1.0 - f * s);
<add> var t = v * (1.0 - (1.0 - f) * s);
<add> var c = [[v, t, p], [q, v, p], [p, v, t], [p, q, v], [t, p, v], [v, p, q]][hi];
<add> return {
<add> r: c[0] * 255,
<add> g: c[1] * 255,
<add> b: c[2] * 255
<add> };
<add> },
<add> rgb_to_hsv: function rgb_to_hsv(r, g, b) {
<add> var min = Math.min(r, g, b);
<add> var max = Math.max(r, g, b);
<add> var delta = max - min;
<add> var h = void 0;
<add> var s = void 0;
<add> if (max !== 0) {
<add> s = delta / max;
<add> } else {
<add> return {
<add> h: NaN,
<add> s: 0,
<add> v: 0
<add> };
<add> }
<add> if (r === max) {
<add> h = (g - b) / delta;
<add> } else if (g === max) {
<add> h = 2 + (b - r) / delta;
<add> } else {
<add> h = 4 + (r - g) / delta;
<add> }
<add> h /= 6;
<add> if (h < 0) {
<add> h += 1;
<add> }
<add> return {
<add> h: h * 360,
<add> s: s,
<add> v: max / 255
<add> };
<add> },
<add> rgb_to_hex: function rgb_to_hex(r, g, b) {
<add> var hex = this.hex_with_component(0, 2, r);
<add> hex = this.hex_with_component(hex, 1, g);
<add> hex = this.hex_with_component(hex, 0, b);
<add> return hex;
<add> },
<add> component_from_hex: function component_from_hex(hex, componentIndex) {
<add> return hex >> componentIndex * 8 & 0xFF;
<add> },
<add> hex_with_component: function hex_with_component(hex, componentIndex, value) {
<add> return value << (tmpComponent = componentIndex * 8) | hex & ~(0xFF << tmpComponent);
<add> }
<add>};
<add>
<add>var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
<add> return typeof obj;
<add>} : function (obj) {
<add> return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
<add>};
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>var classCallCheck = function (instance, Constructor) {
<add> if (!(instance instanceof Constructor)) {
<add> throw new TypeError("Cannot call a class as a function");
<add> }
<add>};
<add>
<add>var createClass = function () {
<add> function defineProperties(target, props) {
<add> for (var i = 0; i < props.length; i++) {
<add> var descriptor = props[i];
<add> descriptor.enumerable = descriptor.enumerable || false;
<add> descriptor.configurable = true;
<add> if ("value" in descriptor) descriptor.writable = true;
<add> Object.defineProperty(target, descriptor.key, descriptor);
<add> }
<add> }
<add>
<add> return function (Constructor, protoProps, staticProps) {
<add> if (protoProps) defineProperties(Constructor.prototype, protoProps);
<add> if (staticProps) defineProperties(Constructor, staticProps);
<add> return Constructor;
<add> };
<add>}();
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>var get = function get(object, property, receiver) {
<add> if (object === null) object = Function.prototype;
<add> var desc = Object.getOwnPropertyDescriptor(object, property);
<add>
<add> if (desc === undefined) {
<add> var parent = Object.getPrototypeOf(object);
<add>
<add> if (parent === null) {
<add> return undefined;
<add> } else {
<add> return get(parent, property, receiver);
<add> }
<add> } else if ("value" in desc) {
<add> return desc.value;
<add> } else {
<add> var getter = desc.get;
<add>
<add> if (getter === undefined) {
<add> return undefined;
<add> }
<add>
<add> return getter.call(receiver);
<add> }
<add>};
<add>
<add>var inherits = function (subClass, superClass) {
<add> if (typeof superClass !== "function" && superClass !== null) {
<add> throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
<add> }
<add>
<add> subClass.prototype = Object.create(superClass && superClass.prototype, {
<add> constructor: {
<add> value: subClass,
<add> enumerable: false,
<add> writable: true,
<add> configurable: true
<add> }
<add> });
<add> if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
<add>};
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>
<add>var possibleConstructorReturn = function (self, call) {
<add> if (!self) {
<add> throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
<add> }
<add>
<add> return call && (typeof call === "object" || typeof call === "function") ? call : self;
<add>};
<add>
<add>var Color = function () {
<add> function Color() {
<add> classCallCheck(this, Color);
<add> this.__state = interpret.apply(this, arguments);
<add> if (this.__state === false) {
<add> throw new Error('Failed to interpret color arguments');
<add> }
<add> this.__state.a = this.__state.a || 1;
<add> }
<add> createClass(Color, [{
<add> key: 'toString',
<add> value: function toString() {
<add> return colorToString(this);
<add> }
<add> }, {
<add> key: 'toHexString',
<add> value: function toHexString() {
<add> return colorToString(this, true);
<add> }
<add> }, {
<add> key: 'toOriginal',
<add> value: function toOriginal() {
<add> return this.__state.conversion.write(this);
<add> }
<add> }]);
<add> return Color;
<add>}();
<add>function defineRGBComponent(target, component, componentHexIndex) {
<add> Object.defineProperty(target, component, {
<add> get: function get$$1() {
<add> if (this.__state.space === 'RGB') {
<add> return this.__state[component];
<add> }
<add> Color.recalculateRGB(this, component, componentHexIndex);
<add> return this.__state[component];
<add> },
<add> set: function set$$1(v) {
<add> if (this.__state.space !== 'RGB') {
<add> Color.recalculateRGB(this, component, componentHexIndex);
<add> this.__state.space = 'RGB';
<add> }
<add> this.__state[component] = v;
<add> }
<add> });
<add>}
<add>function defineHSVComponent(target, component) {
<add> Object.defineProperty(target, component, {
<add> get: function get$$1() {
<add> if (this.__state.space === 'HSV') {
<add> return this.__state[component];
<add> }
<add> Color.recalculateHSV(this);
<add> return this.__state[component];
<add> },
<add> set: function set$$1(v) {
<add> if (this.__state.space !== 'HSV') {
<add> Color.recalculateHSV(this);
<add> this.__state.space = 'HSV';
<add> }
<add> this.__state[component] = v;
<add> }
<add> });
<add>}
<add>Color.recalculateRGB = function (color, component, componentHexIndex) {
<add> if (color.__state.space === 'HEX') {
<add> color.__state[component] = ColorMath.component_from_hex(color.__state.hex, componentHexIndex);
<add> } else if (color.__state.space === 'HSV') {
<add> Common.extend(color.__state, ColorMath.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v));
<add> } else {
<add> throw new Error('Corrupted color state');
<add> }
<add>};
<add>Color.recalculateHSV = function (color) {
<add> var result = ColorMath.rgb_to_hsv(color.r, color.g, color.b);
<add> Common.extend(color.__state, {
<add> s: result.s,
<add> v: result.v
<add> });
<add> if (!Common.isNaN(result.h)) {
<add> color.__state.h = result.h;
<add> } else if (Common.isUndefined(color.__state.h)) {
<add> color.__state.h = 0;
<add> }
<add>};
<add>Color.COMPONENTS = ['r', 'g', 'b', 'h', 's', 'v', 'hex', 'a'];
<add>defineRGBComponent(Color.prototype, 'r', 2);
<add>defineRGBComponent(Color.prototype, 'g', 1);
<add>defineRGBComponent(Color.prototype, 'b', 0);
<add>defineHSVComponent(Color.prototype, 'h');
<add>defineHSVComponent(Color.prototype, 's');
<add>defineHSVComponent(Color.prototype, 'v');
<add>Object.defineProperty(Color.prototype, 'a', {
<add> get: function get$$1() {
<add> return this.__state.a;
<add> },
<add> set: function set$$1(v) {
<add> this.__state.a = v;
<add> }
<add>});
<add>Object.defineProperty(Color.prototype, 'hex', {
<add> get: function get$$1() {
<add> if (!this.__state.space !== 'HEX') {
<add> this.__state.hex = ColorMath.rgb_to_hex(this.r, this.g, this.b);
<add> }
<add> return this.__state.hex;
<add> },
<add> set: function set$$1(v) {
<add> this.__state.space = 'HEX';
<add> this.__state.hex = v;
<add> }
<add>});
<add>
<add>var Controller = function () {
<add> function Controller(object, property) {
<add> classCallCheck(this, Controller);
<add> this.initialValue = object[property];
<add> this.domElement = document.createElement('div');
<add> this.object = object;
<add> this.property = property;
<add> this.__onChange = undefined;
<add> this.__onFinishChange = undefined;
<add> }
<add> createClass(Controller, [{
<add> key: 'onChange',
<add> value: function onChange(fnc) {
<add> this.__onChange = fnc;
<add> return this;
<add> }
<add> }, {
<add> key: 'onFinishChange',
<add> value: function onFinishChange(fnc) {
<add> this.__onFinishChange = fnc;
<add> return this;
<add> }
<add> }, {
<add> key: 'setValue',
<add> value: function setValue(newValue) {
<add> this.object[this.property] = newValue;
<add> if (this.__onChange) {
<add> this.__onChange.call(this, newValue);
<add> }
<add> this.updateDisplay();
<add> return this;
<add> }
<add> }, {
<add> key: 'getValue',
<add> value: function getValue() {
<add> return this.object[this.property];
<add> }
<add> }, {
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> return this;
<add> }
<add> }, {
<add> key: 'isModified',
<add> value: function isModified() {
<add> return this.initialValue !== this.getValue();
<add> }
<add> }]);
<add> return Controller;
<add>}();
<add>
<add>var EVENT_MAP = {
<add> HTMLEvents: ['change'],
<add> MouseEvents: ['click', 'mousemove', 'mousedown', 'mouseup', 'mouseover'],
<add> KeyboardEvents: ['keydown']
<add>};
<add>var EVENT_MAP_INV = {};
<add>Common.each(EVENT_MAP, function (v, k) {
<add> Common.each(v, function (e) {
<add> EVENT_MAP_INV[e] = k;
<add> });
<add>});
<add>var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/;
<add>function cssValueToPixels(val) {
<add> if (val === '0' || Common.isUndefined(val)) {
<add> return 0;
<add> }
<add> var match = val.match(CSS_VALUE_PIXELS);
<add> if (!Common.isNull(match)) {
<add> return parseFloat(match[1]);
<add> }
<add> return 0;
<add>}
<add>var dom = {
<add> makeSelectable: function makeSelectable(elem, selectable) {
<add> if (elem === undefined || elem.style === undefined) return;
<add> elem.onselectstart = selectable ? function () {
<add> return false;
<add> } : function () {};
<add> elem.style.MozUserSelect = selectable ? 'auto' : 'none';
<add> elem.style.KhtmlUserSelect = selectable ? 'auto' : 'none';
<add> elem.unselectable = selectable ? 'on' : 'off';
<add> },
<add> makeFullscreen: function makeFullscreen(elem, hor, vert) {
<add> var vertical = vert;
<add> var horizontal = hor;
<add> if (Common.isUndefined(horizontal)) {
<add> horizontal = true;
<add> }
<add> if (Common.isUndefined(vertical)) {
<add> vertical = true;
<add> }
<add> elem.style.position = 'absolute';
<add> if (horizontal) {
<add> elem.style.left = 0;
<add> elem.style.right = 0;
<add> }
<add> if (vertical) {
<add> elem.style.top = 0;
<add> elem.style.bottom = 0;
<add> }
<add> },
<add> fakeEvent: function fakeEvent(elem, eventType, pars, aux) {
<add> var params = pars || {};
<add> var className = EVENT_MAP_INV[eventType];
<add> if (!className) {
<add> throw new Error('Event type ' + eventType + ' not supported.');
<add> }
<add> var evt = document.createEvent(className);
<add> switch (className) {
<add> case 'MouseEvents':
<add> {
<add> var clientX = params.x || params.clientX || 0;
<add> var clientY = params.y || params.clientY || 0;
<add> evt.initMouseEvent(eventType, params.bubbles || false, params.cancelable || true, window, params.clickCount || 1, 0,
<add> 0,
<add> clientX,
<add> clientY,
<add> false, false, false, false, 0, null);
<add> break;
<add> }
<add> case 'KeyboardEvents':
<add> {
<add> var init = evt.initKeyboardEvent || evt.initKeyEvent;
<add> Common.defaults(params, {
<add> cancelable: true,
<add> ctrlKey: false,
<add> altKey: false,
<add> shiftKey: false,
<add> metaKey: false,
<add> keyCode: undefined,
<add> charCode: undefined
<add> });
<add> init(eventType, params.bubbles || false, params.cancelable, window, params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, params.keyCode, params.charCode);
<add> break;
<add> }
<add> default:
<add> {
<add> evt.initEvent(eventType, params.bubbles || false, params.cancelable || true);
<add> break;
<add> }
<add> }
<add> Common.defaults(evt, aux);
<add> elem.dispatchEvent(evt);
<add> },
<add> bind: function bind(elem, event, func, newBool) {
<add> var bool = newBool || false;
<add> if (elem.addEventListener) {
<add> elem.addEventListener(event, func, bool);
<add> } else if (elem.attachEvent) {
<add> elem.attachEvent('on' + event, func);
<add> }
<add> return dom;
<add> },
<add> unbind: function unbind(elem, event, func, newBool) {
<add> var bool = newBool || false;
<add> if (elem.removeEventListener) {
<add> elem.removeEventListener(event, func, bool);
<add> } else if (elem.detachEvent) {
<add> elem.detachEvent('on' + event, func);
<add> }
<add> return dom;
<add> },
<add> addClass: function addClass(elem, className) {
<add> if (elem.className === undefined) {
<add> elem.className = className;
<add> } else if (elem.className !== className) {
<add> var classes = elem.className.split(/ +/);
<add> if (classes.indexOf(className) === -1) {
<add> classes.push(className);
<add> elem.className = classes.join(' ').replace(/^\s+/, '').replace(/\s+$/, '');
<add> }
<add> }
<add> return dom;
<add> },
<add> removeClass: function removeClass(elem, className) {
<add> if (className) {
<add> if (elem.className === className) {
<add> elem.removeAttribute('class');
<add> } else {
<add> var classes = elem.className.split(/ +/);
<add> var index = classes.indexOf(className);
<add> if (index !== -1) {
<add> classes.splice(index, 1);
<add> elem.className = classes.join(' ');
<add> }
<add> }
<add> } else {
<add> elem.className = undefined;
<add> }
<add> return dom;
<add> },
<add> hasClass: function hasClass(elem, className) {
<add> return new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)').test(elem.className) || false;
<add> },
<add> getWidth: function getWidth(elem) {
<add> var style = getComputedStyle(elem);
<add> return cssValueToPixels(style['border-left-width']) + cssValueToPixels(style['border-right-width']) + cssValueToPixels(style['padding-left']) + cssValueToPixels(style['padding-right']) + cssValueToPixels(style.width);
<add> },
<add> getHeight: function getHeight(elem) {
<add> var style = getComputedStyle(elem);
<add> return cssValueToPixels(style['border-top-width']) + cssValueToPixels(style['border-bottom-width']) + cssValueToPixels(style['padding-top']) + cssValueToPixels(style['padding-bottom']) + cssValueToPixels(style.height);
<add> },
<add> getOffset: function getOffset(el) {
<add> var elem = el;
<add> var offset = { left: 0, top: 0 };
<add> if (elem.offsetParent) {
<add> do {
<add> offset.left += elem.offsetLeft;
<add> offset.top += elem.offsetTop;
<add> elem = elem.offsetParent;
<add> } while (elem);
<add> }
<add> return offset;
<add> },
<add> isActive: function isActive(elem) {
<add> return elem === document.activeElement && (elem.type || elem.href);
<add> }
<add>};
<add>
<add>var BooleanController = function (_Controller) {
<add> inherits(BooleanController, _Controller);
<add> function BooleanController(object, property) {
<add> classCallCheck(this, BooleanController);
<add> var _this2 = possibleConstructorReturn(this, (BooleanController.__proto__ || Object.getPrototypeOf(BooleanController)).call(this, object, property));
<add> var _this = _this2;
<add> _this2.__prev = _this2.getValue();
<add> _this2.__checkbox = document.createElement('input');
<add> _this2.__checkbox.setAttribute('type', 'checkbox');
<add> function onChange() {
<add> _this.setValue(!_this.__prev);
<add> }
<add> dom.bind(_this2.__checkbox, 'change', onChange, false);
<add> _this2.domElement.appendChild(_this2.__checkbox);
<add> _this2.updateDisplay();
<add> return _this2;
<add> }
<add> createClass(BooleanController, [{
<add> key: 'setValue',
<add> value: function setValue(v) {
<add> var toReturn = get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), 'setValue', this).call(this, v);
<add> if (this.__onFinishChange) {
<add> this.__onFinishChange.call(this, this.getValue());
<add> }
<add> this.__prev = this.getValue();
<add> return toReturn;
<add> }
<add> }, {
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> if (this.getValue() === true) {
<add> this.__checkbox.setAttribute('checked', 'checked');
<add> this.__checkbox.checked = true;
<add> this.__prev = true;
<add> } else {
<add> this.__checkbox.checked = false;
<add> this.__prev = false;
<add> }
<add> return get(BooleanController.prototype.__proto__ || Object.getPrototypeOf(BooleanController.prototype), 'updateDisplay', this).call(this);
<add> }
<add> }]);
<add> return BooleanController;
<add>}(Controller);
<add>
<add>var OptionController = function (_Controller) {
<add> inherits(OptionController, _Controller);
<add> function OptionController(object, property, opts) {
<add> classCallCheck(this, OptionController);
<add> var _this2 = possibleConstructorReturn(this, (OptionController.__proto__ || Object.getPrototypeOf(OptionController)).call(this, object, property));
<add> var options = opts;
<add> var _this = _this2;
<add> _this2.__select = document.createElement('select');
<add> if (Common.isArray(options)) {
<add> var map = {};
<add> Common.each(options, function (element) {
<add> map[element] = element;
<add> });
<add> options = map;
<add> }
<add> Common.each(options, function (value, key) {
<add> var opt = document.createElement('option');
<add> opt.innerHTML = key;
<add> opt.setAttribute('value', value);
<add> _this.__select.appendChild(opt);
<add> });
<add> _this2.updateDisplay();
<add> dom.bind(_this2.__select, 'change', function () {
<add> var desiredValue = this.options[this.selectedIndex].value;
<add> _this.setValue(desiredValue);
<add> });
<add> _this2.domElement.appendChild(_this2.__select);
<add> return _this2;
<add> }
<add> createClass(OptionController, [{
<add> key: 'setValue',
<add> value: function setValue(v) {
<add> var toReturn = get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), 'setValue', this).call(this, v);
<add> if (this.__onFinishChange) {
<add> this.__onFinishChange.call(this, this.getValue());
<add> }
<add> return toReturn;
<add> }
<add> }, {
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> if (dom.isActive(this.__select)) return this;
<add> this.__select.value = this.getValue();
<add> return get(OptionController.prototype.__proto__ || Object.getPrototypeOf(OptionController.prototype), 'updateDisplay', this).call(this);
<add> }
<add> }]);
<add> return OptionController;
<add>}(Controller);
<add>
<add>var StringController = function (_Controller) {
<add> inherits(StringController, _Controller);
<add> function StringController(object, property) {
<add> classCallCheck(this, StringController);
<add> var _this2 = possibleConstructorReturn(this, (StringController.__proto__ || Object.getPrototypeOf(StringController)).call(this, object, property));
<add> var _this = _this2;
<add> function onChange() {
<add> _this.setValue(_this.__input.value);
<add> }
<add> function onBlur() {
<add> if (_this.__onFinishChange) {
<add> _this.__onFinishChange.call(_this, _this.getValue());
<add> }
<add> }
<add> _this2.__input = document.createElement('input');
<add> _this2.__input.setAttribute('type', 'text');
<add> dom.bind(_this2.__input, 'keyup', onChange);
<add> dom.bind(_this2.__input, 'change', onChange);
<add> dom.bind(_this2.__input, 'blur', onBlur);
<add> dom.bind(_this2.__input, 'keydown', function (e) {
<add> if (e.keyCode === 13) {
<add> this.blur();
<add> }
<add> });
<add> _this2.updateDisplay();
<add> _this2.domElement.appendChild(_this2.__input);
<add> return _this2;
<add> }
<add> createClass(StringController, [{
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> if (!dom.isActive(this.__input)) {
<add> this.__input.value = this.getValue();
<add> }
<add> return get(StringController.prototype.__proto__ || Object.getPrototypeOf(StringController.prototype), 'updateDisplay', this).call(this);
<add> }
<add> }]);
<add> return StringController;
<add>}(Controller);
<add>
<add>function numDecimals(x) {
<add> var _x = x.toString();
<add> if (_x.indexOf('.') > -1) {
<add> return _x.length - _x.indexOf('.') - 1;
<add> }
<add> return 0;
<add>}
<add>var NumberController = function (_Controller) {
<add> inherits(NumberController, _Controller);
<add> function NumberController(object, property, params) {
<add> classCallCheck(this, NumberController);
<add> var _this = possibleConstructorReturn(this, (NumberController.__proto__ || Object.getPrototypeOf(NumberController)).call(this, object, property));
<add> var _params = params || {};
<add> _this.__min = _params.min;
<add> _this.__max = _params.max;
<add> _this.__step = _params.step;
<add> if (Common.isUndefined(_this.__step)) {
<add> if (_this.initialValue === 0) {
<add> _this.__impliedStep = 1;
<add> } else {
<add> _this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(_this.initialValue)) / Math.LN10)) / 10;
<add> }
<add> } else {
<add> _this.__impliedStep = _this.__step;
<add> }
<add> _this.__precision = numDecimals(_this.__impliedStep);
<add> return _this;
<add> }
<add> createClass(NumberController, [{
<add> key: 'setValue',
<add> value: function setValue(v) {
<add> var _v = v;
<add> if (this.__min !== undefined && _v < this.__min) {
<add> _v = this.__min;
<add> } else if (this.__max !== undefined && _v > this.__max) {
<add> _v = this.__max;
<add> }
<add> if (this.__step !== undefined && _v % this.__step !== 0) {
<add> _v = Math.round(_v / this.__step) * this.__step;
<add> }
<add> return get(NumberController.prototype.__proto__ || Object.getPrototypeOf(NumberController.prototype), 'setValue', this).call(this, _v);
<add> }
<add> }, {
<add> key: 'min',
<add> value: function min(minValue) {
<add> this.__min = minValue;
<add> return this;
<add> }
<add> }, {
<add> key: 'max',
<add> value: function max(maxValue) {
<add> this.__max = maxValue;
<add> return this;
<add> }
<add> }, {
<add> key: 'step',
<add> value: function step(stepValue) {
<add> this.__step = stepValue;
<add> this.__impliedStep = stepValue;
<add> this.__precision = numDecimals(stepValue);
<add> return this;
<add> }
<add> }]);
<add> return NumberController;
<add>}(Controller);
<add>
<add>function roundToDecimal(value, decimals) {
<add> var tenTo = Math.pow(10, decimals);
<add> return Math.round(value * tenTo) / tenTo;
<add>}
<add>var NumberControllerBox = function (_NumberController) {
<add> inherits(NumberControllerBox, _NumberController);
<add> function NumberControllerBox(object, property, params) {
<add> classCallCheck(this, NumberControllerBox);
<add> var _this2 = possibleConstructorReturn(this, (NumberControllerBox.__proto__ || Object.getPrototypeOf(NumberControllerBox)).call(this, object, property, params));
<add> _this2.__truncationSuspended = false;
<add> var _this = _this2;
<add> var prevY = void 0;
<add> function onChange() {
<add> var attempted = parseFloat(_this.__input.value);
<add> if (!Common.isNaN(attempted)) {
<add> _this.setValue(attempted);
<add> }
<add> }
<add> function onFinish() {
<add> if (_this.__onFinishChange) {
<add> _this.__onFinishChange.call(_this, _this.getValue());
<add> }
<add> }
<add> function onBlur() {
<add> onFinish();
<add> }
<add> function onMouseDrag(e) {
<add> var diff = prevY - e.clientY;
<add> _this.setValue(_this.getValue() + diff * _this.__impliedStep);
<add> prevY = e.clientY;
<add> }
<add> function onMouseUp() {
<add> dom.unbind(window, 'mousemove', onMouseDrag);
<add> dom.unbind(window, 'mouseup', onMouseUp);
<add> onFinish();
<add> }
<add> function onMouseDown(e) {
<add> dom.bind(window, 'mousemove', onMouseDrag);
<add> dom.bind(window, 'mouseup', onMouseUp);
<add> prevY = e.clientY;
<add> }
<add> _this2.__input = document.createElement('input');
<add> _this2.__input.setAttribute('type', 'text');
<add> dom.bind(_this2.__input, 'change', onChange);
<add> dom.bind(_this2.__input, 'blur', onBlur);
<add> dom.bind(_this2.__input, 'mousedown', onMouseDown);
<add> dom.bind(_this2.__input, 'keydown', function (e) {
<add> if (e.keyCode === 13) {
<add> _this.__truncationSuspended = true;
<add> this.blur();
<add> _this.__truncationSuspended = false;
<add> onFinish();
<add> }
<add> });
<add> _this2.updateDisplay();
<add> _this2.domElement.appendChild(_this2.__input);
<add> return _this2;
<add> }
<add> createClass(NumberControllerBox, [{
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
<add> return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this);
<add> }
<add> }]);
<add> return NumberControllerBox;
<add>}(NumberController);
<add>
<add>function map(v, i1, i2, o1, o2) {
<add> return o1 + (o2 - o1) * ((v - i1) / (i2 - i1));
<add>}
<add>var NumberControllerSlider = function (_NumberController) {
<add> inherits(NumberControllerSlider, _NumberController);
<add> function NumberControllerSlider(object, property, min, max, step) {
<add> classCallCheck(this, NumberControllerSlider);
<add> var _this2 = possibleConstructorReturn(this, (NumberControllerSlider.__proto__ || Object.getPrototypeOf(NumberControllerSlider)).call(this, object, property, { min: min, max: max, step: step }));
<add> var _this = _this2;
<add> _this2.__background = document.createElement('div');
<add> _this2.__foreground = document.createElement('div');
<add> dom.bind(_this2.__background, 'mousedown', onMouseDown);
<add> dom.bind(_this2.__background, 'touchstart', onTouchStart);
<add> dom.addClass(_this2.__background, 'slider');
<add> dom.addClass(_this2.__foreground, 'slider-fg');
<add> function onMouseDown(e) {
<add> document.activeElement.blur();
<add> dom.bind(window, 'mousemove', onMouseDrag);
<add> dom.bind(window, 'mouseup', onMouseUp);
<add> onMouseDrag(e);
<add> }
<add> function onMouseDrag(e) {
<add> e.preventDefault();
<add> var bgRect = _this.__background.getBoundingClientRect();
<add> _this.setValue(map(e.clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
<add> return false;
<add> }
<add> function onMouseUp() {
<add> dom.unbind(window, 'mousemove', onMouseDrag);
<add> dom.unbind(window, 'mouseup', onMouseUp);
<add> if (_this.__onFinishChange) {
<add> _this.__onFinishChange.call(_this, _this.getValue());
<add> }
<add> }
<add> function onTouchStart(e) {
<add> if (e.touches.length !== 1) {
<add> return;
<add> }
<add> dom.bind(window, 'touchmove', onTouchMove);
<add> dom.bind(window, 'touchend', onTouchEnd);
<add> onTouchMove(e);
<add> }
<add> function onTouchMove(e) {
<add> var clientX = e.touches[0].clientX;
<add> var bgRect = _this.__background.getBoundingClientRect();
<add> _this.setValue(map(clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
<add> }
<add> function onTouchEnd() {
<add> dom.unbind(window, 'touchmove', onTouchMove);
<add> dom.unbind(window, 'touchend', onTouchEnd);
<add> if (_this.__onFinishChange) {
<add> _this.__onFinishChange.call(_this, _this.getValue());
<add> }
<add> }
<add> _this2.updateDisplay();
<add> _this2.__background.appendChild(_this2.__foreground);
<add> _this2.domElement.appendChild(_this2.__background);
<add> return _this2;
<add> }
<add> createClass(NumberControllerSlider, [{
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
<add> this.__foreground.style.width = pct * 100 + '%';
<add> return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this);
<add> }
<add> }]);
<add> return NumberControllerSlider;
<add>}(NumberController);
<add>
<add>var FunctionController = function (_Controller) {
<add> inherits(FunctionController, _Controller);
<add> function FunctionController(object, property, text) {
<add> classCallCheck(this, FunctionController);
<add> var _this2 = possibleConstructorReturn(this, (FunctionController.__proto__ || Object.getPrototypeOf(FunctionController)).call(this, object, property));
<add> var _this = _this2;
<add> _this2.__button = document.createElement('div');
<add> _this2.__button.innerHTML = text === undefined ? 'Fire' : text;
<add> dom.bind(_this2.__button, 'click', function (e) {
<add> e.preventDefault();
<add> _this.fire();
<add> return false;
<add> });
<add> dom.addClass(_this2.__button, 'button');
<add> _this2.domElement.appendChild(_this2.__button);
<add> return _this2;
<add> }
<add> createClass(FunctionController, [{
<add> key: 'fire',
<add> value: function fire() {
<add> if (this.__onChange) {
<add> this.__onChange.call(this);
<add> }
<add> this.getValue().call(this.object);
<add> if (this.__onFinishChange) {
<add> this.__onFinishChange.call(this, this.getValue());
<add> }
<add> }
<add> }]);
<add> return FunctionController;
<add>}(Controller);
<add>
<add>var ColorController = function (_Controller) {
<add> inherits(ColorController, _Controller);
<add> function ColorController(object, property) {
<add> classCallCheck(this, ColorController);
<add> var _this2 = possibleConstructorReturn(this, (ColorController.__proto__ || Object.getPrototypeOf(ColorController)).call(this, object, property));
<add> _this2.__color = new Color(_this2.getValue());
<add> _this2.__temp = new Color(0);
<add> var _this = _this2;
<add> _this2.domElement = document.createElement('div');
<add> dom.makeSelectable(_this2.domElement, false);
<add> _this2.__selector = document.createElement('div');
<add> _this2.__selector.className = 'selector';
<add> _this2.__saturation_field = document.createElement('div');
<add> _this2.__saturation_field.className = 'saturation-field';
<add> _this2.__field_knob = document.createElement('div');
<add> _this2.__field_knob.className = 'field-knob';
<add> _this2.__field_knob_border = '2px solid ';
<add> _this2.__hue_knob = document.createElement('div');
<add> _this2.__hue_knob.className = 'hue-knob';
<add> _this2.__hue_field = document.createElement('div');
<add> _this2.__hue_field.className = 'hue-field';
<add> _this2.__input = document.createElement('input');
<add> _this2.__input.type = 'text';
<add> _this2.__input_textShadow = '0 1px 1px ';
<add> dom.bind(_this2.__input, 'keydown', function (e) {
<add> if (e.keyCode === 13) {
<add> onBlur.call(this);
<add> }
<add> });
<add> dom.bind(_this2.__input, 'blur', onBlur);
<add> dom.bind(_this2.__selector, 'mousedown', function () {
<add> dom.addClass(this, 'drag').bind(window, 'mouseup', function () {
<add> dom.removeClass(_this.__selector, 'drag');
<add> });
<add> });
<add> dom.bind(_this2.__selector, 'touchstart', function () {
<add> dom.addClass(this, 'drag').bind(window, 'touchend', function () {
<add> dom.removeClass(_this.__selector, 'drag');
<add> });
<add> });
<add> var valueField = document.createElement('div');
<add> Common.extend(_this2.__selector.style, {
<add> width: '122px',
<add> height: '102px',
<add> padding: '3px',
<add> backgroundColor: '#222',
<add> boxShadow: '0px 1px 3px rgba(0,0,0,0.3)'
<add> });
<add> Common.extend(_this2.__field_knob.style, {
<add> position: 'absolute',
<add> width: '12px',
<add> height: '12px',
<add> border: _this2.__field_knob_border + (_this2.__color.v < 0.5 ? '#fff' : '#000'),
<add> boxShadow: '0px 1px 3px rgba(0,0,0,0.5)',
<add> borderRadius: '12px',
<add> zIndex: 1
<add> });
<add> Common.extend(_this2.__hue_knob.style, {
<add> position: 'absolute',
<add> width: '15px',
<add> height: '2px',
<add> borderRight: '4px solid #fff',
<add> zIndex: 1
<add> });
<add> Common.extend(_this2.__saturation_field.style, {
<add> width: '100px',
<add> height: '100px',
<add> border: '1px solid #555',
<add> marginRight: '3px',
<add> display: 'inline-block',
<add> cursor: 'pointer'
<add> });
<add> Common.extend(valueField.style, {
<add> width: '100%',
<add> height: '100%',
<add> background: 'none'
<add> });
<add> linearGradient(valueField, 'top', 'rgba(0,0,0,0)', '#000');
<add> Common.extend(_this2.__hue_field.style, {
<add> width: '15px',
<add> height: '100px',
<add> border: '1px solid #555',
<add> cursor: 'ns-resize',
<add> position: 'absolute',
<add> top: '3px',
<add> right: '3px'
<add> });
<add> hueGradient(_this2.__hue_field);
<add> Common.extend(_this2.__input.style, {
<add> outline: 'none',
<add> textAlign: 'center',
<add> color: '#fff',
<add> border: 0,
<add> fontWeight: 'bold',
<add> textShadow: _this2.__input_textShadow + 'rgba(0,0,0,0.7)'
<add> });
<add> dom.bind(_this2.__saturation_field, 'mousedown', fieldDown);
<add> dom.bind(_this2.__saturation_field, 'touchstart', fieldDown);
<add> dom.bind(_this2.__field_knob, 'mousedown', fieldDown);
<add> dom.bind(_this2.__field_knob, 'touchstart', fieldDown);
<add> dom.bind(_this2.__hue_field, 'mousedown', fieldDownH);
<add> dom.bind(_this2.__hue_field, 'touchstart', fieldDownH);
<add> function fieldDown(e) {
<add> setSV(e);
<add> dom.bind(window, 'mousemove', setSV);
<add> dom.bind(window, 'touchmove', setSV);
<add> dom.bind(window, 'mouseup', fieldUpSV);
<add> dom.bind(window, 'touchend', fieldUpSV);
<add> }
<add> function fieldDownH(e) {
<add> setH(e);
<add> dom.bind(window, 'mousemove', setH);
<add> dom.bind(window, 'touchmove', setH);
<add> dom.bind(window, 'mouseup', fieldUpH);
<add> dom.bind(window, 'touchend', fieldUpH);
<add> }
<add> function fieldUpSV() {
<add> dom.unbind(window, 'mousemove', setSV);
<add> dom.unbind(window, 'touchmove', setSV);
<add> dom.unbind(window, 'mouseup', fieldUpSV);
<add> dom.unbind(window, 'touchend', fieldUpSV);
<add> onFinish();
<add> }
<add> function fieldUpH() {
<add> dom.unbind(window, 'mousemove', setH);
<add> dom.unbind(window, 'touchmove', setH);
<add> dom.unbind(window, 'mouseup', fieldUpH);
<add> dom.unbind(window, 'touchend', fieldUpH);
<add> onFinish();
<add> }
<add> function onBlur() {
<add> var i = interpret(this.value);
<add> if (i !== false) {
<add> _this.__color.__state = i;
<add> _this.setValue(_this.__color.toOriginal());
<add> } else {
<add> this.value = _this.__color.toString();
<add> }
<add> }
<add> function onFinish() {
<add> if (_this.__onFinishChange) {
<add> _this.__onFinishChange.call(_this, _this.__color.toOriginal());
<add> }
<add> }
<add> _this2.__saturation_field.appendChild(valueField);
<add> _this2.__selector.appendChild(_this2.__field_knob);
<add> _this2.__selector.appendChild(_this2.__saturation_field);
<add> _this2.__selector.appendChild(_this2.__hue_field);
<add> _this2.__hue_field.appendChild(_this2.__hue_knob);
<add> _this2.domElement.appendChild(_this2.__input);
<add> _this2.domElement.appendChild(_this2.__selector);
<add> _this2.updateDisplay();
<add> function setSV(e) {
<add> if (e.type.indexOf('touch') === -1) {
<add> e.preventDefault();
<add> }
<add> var fieldRect = _this.__saturation_field.getBoundingClientRect();
<add> var _ref = e.touches && e.touches[0] || e,
<add> clientX = _ref.clientX,
<add> clientY = _ref.clientY;
<add> var s = (clientX - fieldRect.left) / (fieldRect.right - fieldRect.left);
<add> var v = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
<add> if (v > 1) {
<add> v = 1;
<add> } else if (v < 0) {
<add> v = 0;
<add> }
<add> if (s > 1) {
<add> s = 1;
<add> } else if (s < 0) {
<add> s = 0;
<add> }
<add> _this.__color.v = v;
<add> _this.__color.s = s;
<add> _this.setValue(_this.__color.toOriginal());
<add> return false;
<add> }
<add> function setH(e) {
<add> if (e.type.indexOf('touch') === -1) {
<add> e.preventDefault();
<add> }
<add> var fieldRect = _this.__hue_field.getBoundingClientRect();
<add> var _ref2 = e.touches && e.touches[0] || e,
<add> clientY = _ref2.clientY;
<add> var h = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
<add> if (h > 1) {
<add> h = 1;
<add> } else if (h < 0) {
<add> h = 0;
<add> }
<add> _this.__color.h = h * 360;
<add> _this.setValue(_this.__color.toOriginal());
<add> return false;
<add> }
<add> return _this2;
<add> }
<add> createClass(ColorController, [{
<add> key: 'updateDisplay',
<add> value: function updateDisplay() {
<add> var i = interpret(this.getValue());
<add> if (i !== false) {
<add> var mismatch = false;
<add> Common.each(Color.COMPONENTS, function (component) {
<add> if (!Common.isUndefined(i[component]) && !Common.isUndefined(this.__color.__state[component]) && i[component] !== this.__color.__state[component]) {
<add> mismatch = true;
<add> return {};
<add> }
<add> }, this);
<add> if (mismatch) {
<add> Common.extend(this.__color.__state, i);
<add> }
<add> }
<add> Common.extend(this.__temp.__state, this.__color.__state);
<add> this.__temp.a = 1;
<add> var flip = this.__color.v < 0.5 || this.__color.s > 0.5 ? 255 : 0;
<add> var _flip = 255 - flip;
<add> Common.extend(this.__field_knob.style, {
<add> marginLeft: 100 * this.__color.s - 7 + 'px',
<add> marginTop: 100 * (1 - this.__color.v) - 7 + 'px',
<add> backgroundColor: this.__temp.toHexString(),
<add> border: this.__field_knob_border + 'rgb(' + flip + ',' + flip + ',' + flip + ')'
<add> });
<add> this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + 'px';
<add> this.__temp.s = 1;
<add> this.__temp.v = 1;
<add> linearGradient(this.__saturation_field, 'left', '#fff', this.__temp.toHexString());
<add> this.__input.value = this.__color.toString();
<add> Common.extend(this.__input.style, {
<add> backgroundColor: this.__color.toHexString(),
<add> color: 'rgb(' + flip + ',' + flip + ',' + flip + ')',
<add> textShadow: this.__input_textShadow + 'rgba(' + _flip + ',' + _flip + ',' + _flip + ',.7)'
<add> });
<add> }
<add> }]);
<add> return ColorController;
<add>}(Controller);
<add>var vendors = ['-moz-', '-o-', '-webkit-', '-ms-', ''];
<add>function linearGradient(elem, x, a, b) {
<add> elem.style.background = '';
<add> Common.each(vendors, function (vendor) {
<add> elem.style.cssText += 'background: ' + vendor + 'linear-gradient(' + x + ', ' + a + ' 0%, ' + b + ' 100%); ';
<add> });
<add>}
<add>function hueGradient(elem) {
<add> elem.style.background = '';
<add> elem.style.cssText += 'background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);';
<add> elem.style.cssText += 'background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
<add> elem.style.cssText += 'background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
<add> elem.style.cssText += 'background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
<add> elem.style.cssText += 'background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);';
<add>}
<add>
<add>var css = {
<add> load: function load(url, indoc) {
<add> var doc = indoc || document;
<add> var link = doc.createElement('link');
<add> link.type = 'text/css';
<add> link.rel = 'stylesheet';
<add> link.href = url;
<add> doc.getElementsByTagName('head')[0].appendChild(link);
<add> },
<add> inject: function inject(cssContent, indoc) {
<add> var doc = indoc || document;
<add> var injected = document.createElement('style');
<add> injected.type = 'text/css';
<add> injected.innerHTML = cssContent;
<add> var head = doc.getElementsByTagName('head')[0];
<add> try {
<add> head.appendChild(injected);
<add> } catch (e) {
<add> }
<add> }
<add>};
<add>
<add>var saveDialogContents = "<div id=\"dg-save\" class=\"dg dialogue\">\n\n Here's the new load parameter for your <code>GUI</code>'s constructor:\n\n <textarea id=\"dg-new-constructor\"></textarea>\n\n <div id=\"dg-save-locally\">\n\n <input id=\"dg-local-storage\" type=\"checkbox\"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id=\"dg-local-explain\">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>";
<add>
<add>var ControllerFactory = function ControllerFactory(object, property) {
<add> var initialValue = object[property];
<add> if (Common.isArray(arguments[2]) || Common.isObject(arguments[2])) {
<add> return new OptionController(object, property, arguments[2]);
<add> }
<add> if (Common.isNumber(initialValue)) {
<add> if (Common.isNumber(arguments[2]) && Common.isNumber(arguments[3])) {
<add> if (Common.isNumber(arguments[4])) {
<add> return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]);
<add> }
<add> return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
<add> }
<add> if (Common.isNumber(arguments[4])) {
<add> return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3], step: arguments[4] });
<add> }
<add> return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] });
<add> }
<add> if (Common.isString(initialValue)) {
<add> return new StringController(object, property);
<add> }
<add> if (Common.isFunction(initialValue)) {
<add> return new FunctionController(object, property, '');
<add> }
<add> if (Common.isBoolean(initialValue)) {
<add> return new BooleanController(object, property);
<add> }
<add> return null;
<add>};
<add>
<add>function requestAnimationFrame(callback) {
<add> setTimeout(callback, 1000 / 60);
<add>}
<add>var requestAnimationFrame$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame;
<add>
<add>var CenteredDiv = function () {
<add> function CenteredDiv() {
<add> classCallCheck(this, CenteredDiv);
<add> this.backgroundElement = document.createElement('div');
<add> Common.extend(this.backgroundElement.style, {
<add> backgroundColor: 'rgba(0,0,0,0.8)',
<add> top: 0,
<add> left: 0,
<add> display: 'none',
<add> zIndex: '1000',
<add> opacity: 0,
<add> WebkitTransition: 'opacity 0.2s linear',
<add> transition: 'opacity 0.2s linear'
<add> });
<add> dom.makeFullscreen(this.backgroundElement);
<add> this.backgroundElement.style.position = 'fixed';
<add> this.domElement = document.createElement('div');
<add> Common.extend(this.domElement.style, {
<add> position: 'fixed',
<add> display: 'none',
<add> zIndex: '1001',
<add> opacity: 0,
<add> WebkitTransition: '-webkit-transform 0.2s ease-out, opacity 0.2s linear',
<add> transition: 'transform 0.2s ease-out, opacity 0.2s linear'
<add> });
<add> document.body.appendChild(this.backgroundElement);
<add> document.body.appendChild(this.domElement);
<add> var _this = this;
<add> dom.bind(this.backgroundElement, 'click', function () {
<add> _this.hide();
<add> });
<add> }
<add> createClass(CenteredDiv, [{
<add> key: 'show',
<add> value: function show() {
<add> var _this = this;
<add> this.backgroundElement.style.display = 'block';
<add> this.domElement.style.display = 'block';
<add> this.domElement.style.opacity = 0;
<add> this.domElement.style.webkitTransform = 'scale(1.1)';
<add> this.layout();
<add> Common.defer(function () {
<add> _this.backgroundElement.style.opacity = 1;
<add> _this.domElement.style.opacity = 1;
<add> _this.domElement.style.webkitTransform = 'scale(1)';
<add> });
<add> }
<add> }, {
<add> key: 'hide',
<add> value: function hide() {
<add> var _this = this;
<add> var hide = function hide() {
<add> _this.domElement.style.display = 'none';
<add> _this.backgroundElement.style.display = 'none';
<add> dom.unbind(_this.domElement, 'webkitTransitionEnd', hide);
<add> dom.unbind(_this.domElement, 'transitionend', hide);
<add> dom.unbind(_this.domElement, 'oTransitionEnd', hide);
<add> };
<add> dom.bind(this.domElement, 'webkitTransitionEnd', hide);
<add> dom.bind(this.domElement, 'transitionend', hide);
<add> dom.bind(this.domElement, 'oTransitionEnd', hide);
<add> this.backgroundElement.style.opacity = 0;
<add> this.domElement.style.opacity = 0;
<add> this.domElement.style.webkitTransform = 'scale(1.1)';
<add> }
<add> }, {
<add> key: 'layout',
<add> value: function layout() {
<add> this.domElement.style.left = window.innerWidth / 2 - dom.getWidth(this.domElement) / 2 + 'px';
<add> this.domElement.style.top = window.innerHeight / 2 - dom.getHeight(this.domElement) / 2 + 'px';
<add> }
<add> }]);
<add> return CenteredDiv;
<add>}();
<add>
<add>var styleSheet = ___$insertStyle(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");
<add>
<add>css.inject(styleSheet);
<add>var CSS_NAMESPACE = 'dg';
<add>var HIDE_KEY_CODE = 72;
<add>var CLOSE_BUTTON_HEIGHT = 20;
<add>var DEFAULT_DEFAULT_PRESET_NAME = 'Default';
<add>var SUPPORTS_LOCAL_STORAGE = function () {
<add> try {
<add> return !!window.localStorage;
<add> } catch (e) {
<add> return false;
<add> }
<add>}();
<add>var SAVE_DIALOGUE = void 0;
<add>var autoPlaceVirgin = true;
<add>var autoPlaceContainer = void 0;
<add>var hide = false;
<add>var hideableGuis = [];
<add>var GUI = function GUI(pars) {
<add> var _this = this;
<add> var params = pars || {};
<add> this.domElement = document.createElement('div');
<add> this.__ul = document.createElement('ul');
<add> this.domElement.appendChild(this.__ul);
<add> dom.addClass(this.domElement, CSS_NAMESPACE);
<add> this.__folders = {};
<add> this.__controllers = [];
<add> this.__rememberedObjects = [];
<add> this.__rememberedObjectIndecesToControllers = [];
<add> this.__listening = [];
<add> params = Common.defaults(params, {
<add> closeOnTop: false,
<add> autoPlace: true,
<add> width: GUI.DEFAULT_WIDTH
<add> });
<add> params = Common.defaults(params, {
<add> resizable: params.autoPlace,
<add> hideable: params.autoPlace
<add> });
<add> if (!Common.isUndefined(params.load)) {
<add> if (params.preset) {
<add> params.load.preset = params.preset;
<add> }
<add> } else {
<add> params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME };
<add> }
<add> if (Common.isUndefined(params.parent) && params.hideable) {
<add> hideableGuis.push(this);
<add> }
<add> params.resizable = Common.isUndefined(params.parent) && params.resizable;
<add> if (params.autoPlace && Common.isUndefined(params.scrollable)) {
<add> params.scrollable = true;
<add> }
<add> var useLocalStorage = SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(this, 'isLocal')) === 'true';
<add> var saveToLocalStorage = void 0;
<add> var titleRow = void 0;
<add> Object.defineProperties(this,
<add> {
<add> parent: {
<add> get: function get$$1() {
<add> return params.parent;
<add> }
<add> },
<add> scrollable: {
<add> get: function get$$1() {
<add> return params.scrollable;
<add> }
<add> },
<add> autoPlace: {
<add> get: function get$$1() {
<add> return params.autoPlace;
<add> }
<add> },
<add> closeOnTop: {
<add> get: function get$$1() {
<add> return params.closeOnTop;
<add> }
<add> },
<add> preset: {
<add> get: function get$$1() {
<add> if (_this.parent) {
<add> return _this.getRoot().preset;
<add> }
<add> return params.load.preset;
<add> },
<add> set: function set$$1(v) {
<add> if (_this.parent) {
<add> _this.getRoot().preset = v;
<add> } else {
<add> params.load.preset = v;
<add> }
<add> setPresetSelectIndex(this);
<add> _this.revert();
<add> }
<add> },
<add> width: {
<add> get: function get$$1() {
<add> return params.width;
<add> },
<add> set: function set$$1(v) {
<add> params.width = v;
<add> setWidth(_this, v);
<add> }
<add> },
<add> name: {
<add> get: function get$$1() {
<add> return params.name;
<add> },
<add> set: function set$$1(v) {
<add> params.name = v;
<add> if (titleRow) {
<add> titleRow.innerHTML = params.name;
<add> }
<add> }
<add> },
<add> closed: {
<add> get: function get$$1() {
<add> return params.closed;
<add> },
<add> set: function set$$1(v) {
<add> params.closed = v;
<add> if (params.closed) {
<add> dom.addClass(_this.__ul, GUI.CLASS_CLOSED);
<add> } else {
<add> dom.removeClass(_this.__ul, GUI.CLASS_CLOSED);
<add> }
<add> this.onResize();
<add> if (_this.__closeButton) {
<add> _this.__closeButton.innerHTML = v ? GUI.TEXT_OPEN : GUI.TEXT_CLOSED;
<add> }
<add> }
<add> },
<add> load: {
<add> get: function get$$1() {
<add> return params.load;
<add> }
<add> },
<add> useLocalStorage: {
<add> get: function get$$1() {
<add> return useLocalStorage;
<add> },
<add> set: function set$$1(bool) {
<add> if (SUPPORTS_LOCAL_STORAGE) {
<add> useLocalStorage = bool;
<add> if (bool) {
<add> dom.bind(window, 'unload', saveToLocalStorage);
<add> } else {
<add> dom.unbind(window, 'unload', saveToLocalStorage);
<add> }
<add> localStorage.setItem(getLocalStorageHash(_this, 'isLocal'), bool);
<add> }
<add> }
<add> }
<add> });
<add> if (Common.isUndefined(params.parent)) {
<add> this.closed = params.closed || false;
<add> dom.addClass(this.domElement, GUI.CLASS_MAIN);
<add> dom.makeSelectable(this.domElement, false);
<add> if (SUPPORTS_LOCAL_STORAGE) {
<add> if (useLocalStorage) {
<add> _this.useLocalStorage = true;
<add> var savedGui = localStorage.getItem(getLocalStorageHash(this, 'gui'));
<add> if (savedGui) {
<add> params.load = JSON.parse(savedGui);
<add> }
<add> }
<add> }
<add> this.__closeButton = document.createElement('div');
<add> this.__closeButton.innerHTML = GUI.TEXT_CLOSED;
<add> dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BUTTON);
<add> if (params.closeOnTop) {
<add> dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_TOP);
<add> this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0]);
<add> } else {
<add> dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BOTTOM);
<add> this.domElement.appendChild(this.__closeButton);
<add> }
<add> dom.bind(this.__closeButton, 'click', function () {
<add> _this.closed = !_this.closed;
<add> });
<add> } else {
<add> if (params.closed === undefined) {
<add> params.closed = true;
<add> }
<add> var titleRowName = document.createTextNode(params.name);
<add> dom.addClass(titleRowName, 'controller-name');
<add> titleRow = addRow(_this, titleRowName);
<add> var onClickTitle = function onClickTitle(e) {
<add> e.preventDefault();
<add> _this.closed = !_this.closed;
<add> return false;
<add> };
<add> dom.addClass(this.__ul, GUI.CLASS_CLOSED);
<add> dom.addClass(titleRow, 'title');
<add> dom.bind(titleRow, 'click', onClickTitle);
<add> if (!params.closed) {
<add> this.closed = false;
<add> }
<add> }
<add> if (params.autoPlace) {
<add> if (Common.isUndefined(params.parent)) {
<add> if (autoPlaceVirgin) {
<add> autoPlaceContainer = document.createElement('div');
<add> dom.addClass(autoPlaceContainer, CSS_NAMESPACE);
<add> dom.addClass(autoPlaceContainer, GUI.CLASS_AUTO_PLACE_CONTAINER);
<add> document.body.appendChild(autoPlaceContainer);
<add> autoPlaceVirgin = false;
<add> }
<add> autoPlaceContainer.appendChild(this.domElement);
<add> dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
<add> }
<add> if (!this.parent) {
<add> setWidth(_this, params.width);
<add> }
<add> }
<add> this.__resizeHandler = function () {
<add> _this.onResizeDebounced();
<add> };
<add> dom.bind(window, 'resize', this.__resizeHandler);
<add> dom.bind(this.__ul, 'webkitTransitionEnd', this.__resizeHandler);
<add> dom.bind(this.__ul, 'transitionend', this.__resizeHandler);
<add> dom.bind(this.__ul, 'oTransitionEnd', this.__resizeHandler);
<add> this.onResize();
<add> if (params.resizable) {
<add> addResizeHandle(this);
<add> }
<add> saveToLocalStorage = function saveToLocalStorage() {
<add> if (SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(_this, 'isLocal')) === 'true') {
<add> localStorage.setItem(getLocalStorageHash(_this, 'gui'), JSON.stringify(_this.getSaveObject()));
<add> }
<add> };
<add> this.saveToLocalStorageIfPossible = saveToLocalStorage;
<add> function resetWidth() {
<add> var root = _this.getRoot();
<add> root.width += 1;
<add> Common.defer(function () {
<add> root.width -= 1;
<add> });
<add> }
<add> if (!params.parent) {
<add> resetWidth();
<add> }
<add>};
<add>GUI.toggleHide = function () {
<add> hide = !hide;
<add> Common.each(hideableGuis, function (gui) {
<add> gui.domElement.style.display = hide ? 'none' : '';
<add> });
<add>};
<add>GUI.CLASS_AUTO_PLACE = 'a';
<add>GUI.CLASS_AUTO_PLACE_CONTAINER = 'ac';
<add>GUI.CLASS_MAIN = 'main';
<add>GUI.CLASS_CONTROLLER_ROW = 'cr';
<add>GUI.CLASS_TOO_TALL = 'taller-than-window';
<add>GUI.CLASS_CLOSED = 'closed';
<add>GUI.CLASS_CLOSE_BUTTON = 'close-button';
<add>GUI.CLASS_CLOSE_TOP = 'close-top';
<add>GUI.CLASS_CLOSE_BOTTOM = 'close-bottom';
<add>GUI.CLASS_DRAG = 'drag';
<add>GUI.DEFAULT_WIDTH = 245;
<add>GUI.TEXT_CLOSED = 'Close Controls';
<add>GUI.TEXT_OPEN = 'Open Controls';
<add>GUI._keydownHandler = function (e) {
<add> if (document.activeElement.type !== 'text' && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) {
<add> GUI.toggleHide();
<add> }
<add>};
<add>dom.bind(window, 'keydown', GUI._keydownHandler, false);
<add>Common.extend(GUI.prototype,
<add>{
<add> add: function add(object, property) {
<add> return _add(this, object, property, {
<add> factoryArgs: Array.prototype.slice.call(arguments, 2)
<add> });
<add> },
<add> addColor: function addColor(object, property) {
<add> return _add(this, object, property, {
<add> color: true
<add> });
<add> },
<add> remove: function remove(controller) {
<add> this.__ul.removeChild(controller.__li);
<add> this.__controllers.splice(this.__controllers.indexOf(controller), 1);
<add> var _this = this;
<add> Common.defer(function () {
<add> _this.onResize();
<add> });
<add> },
<add> destroy: function destroy() {
<add> if (this.parent) {
<add> throw new Error('Only the root GUI should be removed with .destroy(). ' + 'For subfolders, use gui.removeFolder(folder) instead.');
<add> }
<add> if (this.autoPlace) {
<add> autoPlaceContainer.removeChild(this.domElement);
<add> }
<add> var _this = this;
<add> Common.each(this.__folders, function (subfolder) {
<add> _this.removeFolder(subfolder);
<add> });
<add> dom.unbind(window, 'keydown', GUI._keydownHandler, false);
<add> removeListeners(this);
<add> },
<add> addFolder: function addFolder(name) {
<add> if (this.__folders[name] !== undefined) {
<add> throw new Error('You already have a folder in this GUI by the' + ' name "' + name + '"');
<add> }
<add> var newGuiParams = { name: name, parent: this };
<add> newGuiParams.autoPlace = this.autoPlace;
<add> if (this.load &&
<add> this.load.folders &&
<add> this.load.folders[name]) {
<add> newGuiParams.closed = this.load.folders[name].closed;
<add> newGuiParams.load = this.load.folders[name];
<add> }
<add> var gui = new GUI(newGuiParams);
<add> this.__folders[name] = gui;
<add> var li = addRow(this, gui.domElement);
<add> dom.addClass(li, 'folder');
<add> return gui;
<add> },
<add> removeFolder: function removeFolder(folder) {
<add> this.__ul.removeChild(folder.domElement.parentElement);
<add> delete this.__folders[folder.name];
<add> if (this.load &&
<add> this.load.folders &&
<add> this.load.folders[folder.name]) {
<add> delete this.load.folders[folder.name];
<add> }
<add> removeListeners(folder);
<add> var _this = this;
<add> Common.each(folder.__folders, function (subfolder) {
<add> folder.removeFolder(subfolder);
<add> });
<add> Common.defer(function () {
<add> _this.onResize();
<add> });
<add> },
<add> open: function open() {
<add> this.closed = false;
<add> },
<add> close: function close() {
<add> this.closed = true;
<add> },
<add> hide: function hide() {
<add> this.domElement.style.display = 'none';
<add> },
<add> show: function show() {
<add> this.domElement.style.display = '';
<add> },
<add> onResize: function onResize() {
<add> var root = this.getRoot();
<add> if (root.scrollable) {
<add> var top = dom.getOffset(root.__ul).top;
<add> var h = 0;
<add> Common.each(root.__ul.childNodes, function (node) {
<add> if (!(root.autoPlace && node === root.__save_row)) {
<add> h += dom.getHeight(node);
<add> }
<add> });
<add> if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) {
<add> dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
<add> root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + 'px';
<add> } else {
<add> dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
<add> root.__ul.style.height = 'auto';
<add> }
<add> }
<add> if (root.__resize_handle) {
<add> Common.defer(function () {
<add> root.__resize_handle.style.height = root.__ul.offsetHeight + 'px';
<add> });
<add> }
<add> if (root.__closeButton) {
<add> root.__closeButton.style.width = root.width + 'px';
<add> }
<add> },
<add> onResizeDebounced: Common.debounce(function () {
<add> this.onResize();
<add> }, 50),
<add> remember: function remember() {
<add> if (Common.isUndefined(SAVE_DIALOGUE)) {
<add> SAVE_DIALOGUE = new CenteredDiv();
<add> SAVE_DIALOGUE.domElement.innerHTML = saveDialogContents;
<add> }
<add> if (this.parent) {
<add> throw new Error('You can only call remember on a top level GUI.');
<add> }
<add> var _this = this;
<add> Common.each(Array.prototype.slice.call(arguments), function (object) {
<add> if (_this.__rememberedObjects.length === 0) {
<add> addSaveMenu(_this);
<add> }
<add> if (_this.__rememberedObjects.indexOf(object) === -1) {
<add> _this.__rememberedObjects.push(object);
<add> }
<add> });
<add> if (this.autoPlace) {
<add> setWidth(this, this.width);
<add> }
<add> },
<add> getRoot: function getRoot() {
<add> var gui = this;
<add> while (gui.parent) {
<add> gui = gui.parent;
<add> }
<add> return gui;
<add> },
<add> getSaveObject: function getSaveObject() {
<add> var toReturn = this.load;
<add> toReturn.closed = this.closed;
<add> if (this.__rememberedObjects.length > 0) {
<add> toReturn.preset = this.preset;
<add> if (!toReturn.remembered) {
<add> toReturn.remembered = {};
<add> }
<add> toReturn.remembered[this.preset] = getCurrentPreset(this);
<add> }
<add> toReturn.folders = {};
<add> Common.each(this.__folders, function (element, key) {
<add> toReturn.folders[key] = element.getSaveObject();
<add> });
<add> return toReturn;
<add> },
<add> save: function save() {
<add> if (!this.load.remembered) {
<add> this.load.remembered = {};
<add> }
<add> this.load.remembered[this.preset] = getCurrentPreset(this);
<add> markPresetModified(this, false);
<add> this.saveToLocalStorageIfPossible();
<add> },
<add> saveAs: function saveAs(presetName) {
<add> if (!this.load.remembered) {
<add> this.load.remembered = {};
<add> this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true);
<add> }
<add> this.load.remembered[presetName] = getCurrentPreset(this);
<add> this.preset = presetName;
<add> addPresetOption(this, presetName, true);
<add> this.saveToLocalStorageIfPossible();
<add> },
<add> revert: function revert(gui) {
<add> Common.each(this.__controllers, function (controller) {
<add> if (!this.getRoot().load.remembered) {
<add> controller.setValue(controller.initialValue);
<add> } else {
<add> recallSavedValue(gui || this.getRoot(), controller);
<add> }
<add> if (controller.__onFinishChange) {
<add> controller.__onFinishChange.call(controller, controller.getValue());
<add> }
<add> }, this);
<add> Common.each(this.__folders, function (folder) {
<add> folder.revert(folder);
<add> });
<add> if (!gui) {
<add> markPresetModified(this.getRoot(), false);
<add> }
<add> },
<add> listen: function listen(controller) {
<add> var init = this.__listening.length === 0;
<add> this.__listening.push(controller);
<add> if (init) {
<add> updateDisplays(this.__listening);
<add> }
<add> },
<add> updateDisplay: function updateDisplay() {
<add> Common.each(this.__controllers, function (controller) {
<add> controller.updateDisplay();
<add> });
<add> Common.each(this.__folders, function (folder) {
<add> folder.updateDisplay();
<add> });
<add> }
<add>});
<add>function addRow(gui, newDom, liBefore) {
<add> var li = document.createElement('li');
<add> if (newDom) {
<add> li.appendChild(newDom);
<add> }
<add> if (liBefore) {
<add> gui.__ul.insertBefore(li, liBefore);
<add> } else {
<add> gui.__ul.appendChild(li);
<add> }
<add> gui.onResize();
<add> return li;
<add>}
<add>function removeListeners(gui) {
<add> dom.unbind(window, 'resize', gui.__resizeHandler);
<add> if (gui.saveToLocalStorageIfPossible) {
<add> dom.unbind(window, 'unload', gui.saveToLocalStorageIfPossible);
<add> }
<add>}
<add>function markPresetModified(gui, modified) {
<add> var opt = gui.__preset_select[gui.__preset_select.selectedIndex];
<add> if (modified) {
<add> opt.innerHTML = opt.value + '*';
<add> } else {
<add> opt.innerHTML = opt.value;
<add> }
<add>}
<add>function augmentController(gui, li, controller) {
<add> controller.__li = li;
<add> controller.__gui = gui;
<add> Common.extend(controller, {
<add> options: function options(_options) {
<add> if (arguments.length > 1) {
<add> var nextSibling = controller.__li.nextElementSibling;
<add> controller.remove();
<add> return _add(gui, controller.object, controller.property, {
<add> before: nextSibling,
<add> factoryArgs: [Common.toArray(arguments)]
<add> });
<add> }
<add> if (Common.isArray(_options) || Common.isObject(_options)) {
<add> var _nextSibling = controller.__li.nextElementSibling;
<add> controller.remove();
<add> return _add(gui, controller.object, controller.property, {
<add> before: _nextSibling,
<add> factoryArgs: [_options]
<add> });
<add> }
<add> },
<add> name: function name(_name) {
<add> controller.__li.firstElementChild.firstElementChild.innerHTML = _name;
<add> return controller;
<add> },
<add> listen: function listen() {
<add> controller.__gui.listen(controller);
<add> return controller;
<add> },
<add> remove: function remove() {
<add> controller.__gui.remove(controller);
<add> return controller;
<add> }
<add> });
<add> if (controller instanceof NumberControllerSlider) {
<add> var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step });
<add> Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function (method) {
<add> var pc = controller[method];
<add> var pb = box[method];
<add> controller[method] = box[method] = function () {
<add> var args = Array.prototype.slice.call(arguments);
<add> pb.apply(box, args);
<add> return pc.apply(controller, args);
<add> };
<add> });
<add> dom.addClass(li, 'has-slider');
<add> controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild);
<add> } else if (controller instanceof NumberControllerBox) {
<add> var r = function r(returned) {
<add> if (Common.isNumber(controller.__min) && Common.isNumber(controller.__max)) {
<add> var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
<add> var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
<add> controller.remove();
<add> var newController = _add(gui, controller.object, controller.property, {
<add> before: controller.__li.nextElementSibling,
<add> factoryArgs: [controller.__min, controller.__max, controller.__step]
<add> });
<add> newController.name(oldName);
<add> if (wasListening) newController.listen();
<add> return newController;
<add> }
<add> return returned;
<add> };
<add> controller.min = Common.compose(r, controller.min);
<add> controller.max = Common.compose(r, controller.max);
<add> } else if (controller instanceof BooleanController) {
<add> dom.bind(li, 'click', function () {
<add> dom.fakeEvent(controller.__checkbox, 'click');
<add> });
<add> dom.bind(controller.__checkbox, 'click', function (e) {
<add> e.stopPropagation();
<add> });
<add> } else if (controller instanceof FunctionController) {
<add> dom.bind(li, 'click', function () {
<add> dom.fakeEvent(controller.__button, 'click');
<add> });
<add> dom.bind(li, 'mouseover', function () {
<add> dom.addClass(controller.__button, 'hover');
<add> });
<add> dom.bind(li, 'mouseout', function () {
<add> dom.removeClass(controller.__button, 'hover');
<add> });
<add> } else if (controller instanceof ColorController) {
<add> dom.addClass(li, 'color');
<add> controller.updateDisplay = Common.compose(function (val) {
<add> li.style.borderLeftColor = controller.__color.toString();
<add> return val;
<add> }, controller.updateDisplay);
<add> controller.updateDisplay();
<add> }
<add> controller.setValue = Common.compose(function (val) {
<add> if (gui.getRoot().__preset_select && controller.isModified()) {
<add> markPresetModified(gui.getRoot(), true);
<add> }
<add> return val;
<add> }, controller.setValue);
<add>}
<add>function recallSavedValue(gui, controller) {
<add> var root = gui.getRoot();
<add> var matchedIndex = root.__rememberedObjects.indexOf(controller.object);
<add> if (matchedIndex !== -1) {
<add> var controllerMap = root.__rememberedObjectIndecesToControllers[matchedIndex];
<add> if (controllerMap === undefined) {
<add> controllerMap = {};
<add> root.__rememberedObjectIndecesToControllers[matchedIndex] = controllerMap;
<add> }
<add> controllerMap[controller.property] = controller;
<add> if (root.load && root.load.remembered) {
<add> var presetMap = root.load.remembered;
<add> var preset = void 0;
<add> if (presetMap[gui.preset]) {
<add> preset = presetMap[gui.preset];
<add> } else if (presetMap[DEFAULT_DEFAULT_PRESET_NAME]) {
<add> preset = presetMap[DEFAULT_DEFAULT_PRESET_NAME];
<add> } else {
<add> return;
<add> }
<add> if (preset[matchedIndex] && preset[matchedIndex][controller.property] !== undefined) {
<add> var value = preset[matchedIndex][controller.property];
<add> controller.initialValue = value;
<add> controller.setValue(value);
<add> }
<add> }
<add> }
<add>}
<add>function _add(gui, object, property, params) {
<add> if (object[property] === undefined) {
<add> throw new Error('Object "' + object + '" has no property "' + property + '"');
<add> }
<add> var controller = void 0;
<add> if (params.color) {
<add> controller = new ColorController(object, property);
<add> } else {
<add> var factoryArgs = [object, property].concat(params.factoryArgs);
<add> controller = ControllerFactory.apply(gui, factoryArgs);
<add> }
<add> if (params.before instanceof Controller) {
<add> params.before = params.before.__li;
<add> }
<add> recallSavedValue(gui, controller);
<add> dom.addClass(controller.domElement, 'c');
<add> var name = document.createElement('span');
<add> dom.addClass(name, 'property-name');
<add> name.innerHTML = controller.property;
<add> var container = document.createElement('div');
<add> container.appendChild(name);
<add> container.appendChild(controller.domElement);
<add> var li = addRow(gui, container, params.before);
<add> dom.addClass(li, GUI.CLASS_CONTROLLER_ROW);
<add> if (controller instanceof ColorController) {
<add> dom.addClass(li, 'color');
<add> } else {
<add> dom.addClass(li, _typeof(controller.getValue()));
<add> }
<add> augmentController(gui, li, controller);
<add> gui.__controllers.push(controller);
<add> return controller;
<add>}
<add>function getLocalStorageHash(gui, key) {
<add> return document.location.href + '.' + key;
<add>}
<add>function addPresetOption(gui, name, setSelected) {
<add> var opt = document.createElement('option');
<add> opt.innerHTML = name;
<add> opt.value = name;
<add> gui.__preset_select.appendChild(opt);
<add> if (setSelected) {
<add> gui.__preset_select.selectedIndex = gui.__preset_select.length - 1;
<add> }
<add>}
<add>function showHideExplain(gui, explain) {
<add> explain.style.display = gui.useLocalStorage ? 'block' : 'none';
<add>}
<add>function addSaveMenu(gui) {
<add> var div = gui.__save_row = document.createElement('li');
<add> dom.addClass(gui.domElement, 'has-save');
<add> gui.__ul.insertBefore(div, gui.__ul.firstChild);
<add> dom.addClass(div, 'save-row');
<add> var gears = document.createElement('span');
<add> gears.innerHTML = ' ';
<add> dom.addClass(gears, 'button gears');
<add> var button = document.createElement('span');
<add> button.innerHTML = 'Save';
<add> dom.addClass(button, 'button');
<add> dom.addClass(button, 'save');
<add> var button2 = document.createElement('span');
<add> button2.innerHTML = 'New';
<add> dom.addClass(button2, 'button');
<add> dom.addClass(button2, 'save-as');
<add> var button3 = document.createElement('span');
<add> button3.innerHTML = 'Revert';
<add> dom.addClass(button3, 'button');
<add> dom.addClass(button3, 'revert');
<add> var select = gui.__preset_select = document.createElement('select');
<add> if (gui.load && gui.load.remembered) {
<add> Common.each(gui.load.remembered, function (value, key) {
<add> addPresetOption(gui, key, key === gui.preset);
<add> });
<add> } else {
<add> addPresetOption(gui, DEFAULT_DEFAULT_PRESET_NAME, false);
<add> }
<add> dom.bind(select, 'change', function () {
<add> for (var index = 0; index < gui.__preset_select.length; index++) {
<add> gui.__preset_select[index].innerHTML = gui.__preset_select[index].value;
<add> }
<add> gui.preset = this.value;
<add> });
<add> div.appendChild(select);
<add> div.appendChild(gears);
<add> div.appendChild(button);
<add> div.appendChild(button2);
<add> div.appendChild(button3);
<add> if (SUPPORTS_LOCAL_STORAGE) {
<add> var explain = document.getElementById('dg-local-explain');
<add> var localStorageCheckBox = document.getElementById('dg-local-storage');
<add> var saveLocally = document.getElementById('dg-save-locally');
<add> saveLocally.style.display = 'block';
<add> if (localStorage.getItem(getLocalStorageHash(gui, 'isLocal')) === 'true') {
<add> localStorageCheckBox.setAttribute('checked', 'checked');
<add> }
<add> showHideExplain(gui, explain);
<add> dom.bind(localStorageCheckBox, 'change', function () {
<add> gui.useLocalStorage = !gui.useLocalStorage;
<add> showHideExplain(gui, explain);
<add> });
<add> }
<add> var newConstructorTextArea = document.getElementById('dg-new-constructor');
<add> dom.bind(newConstructorTextArea, 'keydown', function (e) {
<add> if (e.metaKey && (e.which === 67 || e.keyCode === 67)) {
<add> SAVE_DIALOGUE.hide();
<add> }
<add> });
<add> dom.bind(gears, 'click', function () {
<add> newConstructorTextArea.innerHTML = JSON.stringify(gui.getSaveObject(), undefined, 2);
<add> SAVE_DIALOGUE.show();
<add> newConstructorTextArea.focus();
<add> newConstructorTextArea.select();
<add> });
<add> dom.bind(button, 'click', function () {
<add> gui.save();
<add> });
<add> dom.bind(button2, 'click', function () {
<add> var presetName = prompt('Enter a new preset name.');
<add> if (presetName) {
<add> gui.saveAs(presetName);
<add> }
<add> });
<add> dom.bind(button3, 'click', function () {
<add> gui.revert();
<add> });
<add>}
<add>function addResizeHandle(gui) {
<add> var pmouseX = void 0;
<add> gui.__resize_handle = document.createElement('div');
<add> Common.extend(gui.__resize_handle.style, {
<add> width: '6px',
<add> marginLeft: '-3px',
<add> height: '200px',
<add> cursor: 'ew-resize',
<add> position: 'absolute'
<add> });
<add> function drag(e) {
<add> e.preventDefault();
<add> gui.width += pmouseX - e.clientX;
<add> gui.onResize();
<add> pmouseX = e.clientX;
<add> return false;
<add> }
<add> function dragStop() {
<add> dom.removeClass(gui.__closeButton, GUI.CLASS_DRAG);
<add> dom.unbind(window, 'mousemove', drag);
<add> dom.unbind(window, 'mouseup', dragStop);
<add> }
<add> function dragStart(e) {
<add> e.preventDefault();
<add> pmouseX = e.clientX;
<add> dom.addClass(gui.__closeButton, GUI.CLASS_DRAG);
<add> dom.bind(window, 'mousemove', drag);
<add> dom.bind(window, 'mouseup', dragStop);
<add> return false;
<add> }
<add> dom.bind(gui.__resize_handle, 'mousedown', dragStart);
<add> dom.bind(gui.__closeButton, 'mousedown', dragStart);
<add> gui.domElement.insertBefore(gui.__resize_handle, gui.domElement.firstElementChild);
<add>}
<add>function setWidth(gui, w) {
<add> gui.domElement.style.width = w + 'px';
<add> if (gui.__save_row && gui.autoPlace) {
<add> gui.__save_row.style.width = w + 'px';
<add> }
<add> if (gui.__closeButton) {
<add> gui.__closeButton.style.width = w + 'px';
<add> }
<add>}
<add>function getCurrentPreset(gui, useInitialValues) {
<add> var toReturn = {};
<add> Common.each(gui.__rememberedObjects, function (val, index) {
<add> var savedValues = {};
<add> var controllerMap = gui.__rememberedObjectIndecesToControllers[index];
<add> Common.each(controllerMap, function (controller, property) {
<add> savedValues[property] = useInitialValues ? controller.initialValue : controller.getValue();
<add> });
<add> toReturn[index] = savedValues;
<add> });
<add> return toReturn;
<add>}
<add>function setPresetSelectIndex(gui) {
<add> for (var index = 0; index < gui.__preset_select.length; index++) {
<add> if (gui.__preset_select[index].value === gui.preset) {
<add> gui.__preset_select.selectedIndex = index;
<add> }
<add> }
<add>}
<add>function updateDisplays(controllerArray) {
<add> if (controllerArray.length !== 0) {
<add> requestAnimationFrame$1.call(window, function () {
<add> updateDisplays(controllerArray);
<add> });
<add> }
<add> Common.each(controllerArray, function (c) {
<add> c.updateDisplay();
<add> });
<add>}
<add>
<add>var color = {
<add> Color: Color,
<add> math: ColorMath,
<add> interpret: interpret
<add>};
<add>var controllers = {
<add> Controller: Controller,
<add> BooleanController: BooleanController,
<add> OptionController: OptionController,
<add> StringController: StringController,
<add> NumberController: NumberController,
<add> NumberControllerBox: NumberControllerBox,
<add> NumberControllerSlider: NumberControllerSlider,
<add> FunctionController: FunctionController,
<add> ColorController: ColorController
<add>};
<add>var dom$1 = { dom: dom };
<add>var gui = { GUI: GUI };
<add>var GUI$1 = GUI;
<add>var index = {
<add> color: color,
<add> controllers: controllers,
<add> dom: dom$1,
<add> gui: gui,
<add> GUI: GUI$1
<add>};
<add>
<add>export { color, controllers, dom$1 as dom, gui, GUI$1 as GUI };
<add>export default index;
<add>//# sourceMappingURL=dat.gui.module.js.map | 1 |
PHP | PHP | add alias for calling with single state | c8682e11b9f0e153654ff5c2a3ad9f8b2dca56d1 | <ide><path>src/Illuminate/Database/Eloquent/FactoryBuilder.php
<ide> public function times($amount)
<ide> return $this;
<ide> }
<ide>
<add> /**
<add> * Set the state to be applied to the model.
<add> *
<add> * @param string $state
<add> * @return $this
<add> */
<add> public function state($state)
<add> {
<add> return $this->states([$state]);
<add> }
<add>
<ide> /**
<ide> * Set the states to be applied to the model.
<ide> *
<ide><path>tests/Integration/Database/EloquentFactoryBuilderTest.php
<ide> protected function getEnvironmentSetUp($app)
<ide>
<ide> $factory->afterMakingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) {
<ide> $server = factory(FactoryBuildableServer::class)
<del> ->states('callable')
<add> ->state('callable')
<ide> ->make(['user_id' => $user->id]);
<ide>
<ide> $user->servers->push($server);
<ide> protected function getEnvironmentSetUp($app)
<ide>
<ide> $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) {
<ide> $server = factory(FactoryBuildableServer::class)
<del> ->states('callable')
<add> ->state('callable')
<ide> ->create(['user_id' => $user->id]);
<ide> });
<ide>
<ide> public function creating_collection_of_models()
<ide> /**
<ide> * @test
<ide> */
<del> public function creating_models_with_callable_states()
<add> public function creating_models_with_callable_state()
<ide> {
<ide> $server = factory(FactoryBuildableServer::class)->create();
<ide>
<del> $callableServer = factory(FactoryBuildableServer::class)->states('callable')->create();
<add> $callableServer = factory(FactoryBuildableServer::class)->state('callable')->create();
<ide>
<ide> $this->assertEquals('active', $server->status);
<ide> $this->assertEquals(['Storage', 'Data'], $server->tags);
<ide> public function creating_models_with_callable_states()
<ide> /**
<ide> * @test
<ide> */
<del> public function creating_models_with_inline_states()
<add> public function creating_models_with_inline_state()
<ide> {
<ide> $server = factory(FactoryBuildableServer::class)->create();
<ide>
<del> $inlineServer = factory(FactoryBuildableServer::class)->states('inline')->create();
<add> $inlineServer = factory(FactoryBuildableServer::class)->state('inline')->create();
<ide>
<ide> $this->assertEquals('active', $server->status);
<ide> $this->assertEquals('inline', $inlineServer->status);
<ide> public function creating_models_with_after_callback()
<ide> }
<ide>
<ide> /** @test **/
<del> public function creating_models_with_after_callback_states()
<add> public function creating_models_with_after_callback_state()
<ide> {
<del> $user = factory(FactoryBuildableUser::class)->states('with_callable_server')->create();
<add> $user = factory(FactoryBuildableUser::class)->state('with_callable_server')->create();
<ide>
<ide> $this->assertNotNull($user->profile);
<ide> $this->assertNotNull($user->servers->where('status', 'callable')->first());
<ide> public function making_models_with_after_callback()
<ide> }
<ide>
<ide> /** @test **/
<del> public function making_models_with_after_callback_states()
<add> public function making_models_with_after_callback_state()
<ide> {
<del> $user = factory(FactoryBuildableUser::class)->states('with_callable_server')->make();
<add> $user = factory(FactoryBuildableUser::class)->state('with_callable_server')->make();
<ide>
<ide> $this->assertNotNull($user->profile);
<ide> $this->assertNotNull($user->servers->where('status', 'callable')->first()); | 2 |
Text | Text | fix links in http2.md | f8ef2e2bf95dd65cb06a7f5e581e856c302f0793 | <ide><path>doc/api/http2.md
<ide> if the stream is closed.
<ide> [`ServerHttp2Stream`]: #http2_class_serverhttp2stream
<ide> [`TypeError`]: errors.html#errors_class_typeerror
<ide> [`http2.SecureServer`]: #http2_class_http2secureserver
<del>[`http2.createSecureServer()`]: #http2_createsecureserver_options_onrequesthandler
<add>[`http2.createSecureServer()`]: #http2_http2_createsecureserver_options_onrequesthandler
<ide> [`http2.Server`]: #http2_class_http2server
<del>[`http2.createServer()`]: #http2_createserver_options_onrequesthandler
<add>[`http2.createServer()`]: #http2_http2_createserver_options_onrequesthandler
<ide> [`http2stream.pushStream()`]: #http2_http2stream_pushstream_headers_options_callback
<ide> [`net.Socket`]: net.html#net_class_net_socket
<ide> [`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed | 1 |
Javascript | Javascript | add destructuring visitor to jsx harmony transform | f02264cf83cc126cb1b7877e1ac66c9d4728979e | <ide><path>vendor/fbtransform/visitors.js
<ide> /*global exports:true*/
<ide> var es6ArrowFunctions = require('jstransform/visitors/es6-arrow-function-visitors');
<ide> var es6Classes = require('jstransform/visitors/es6-class-visitors');
<add>var es6Destructuring = require('jstransform/visitors/es6-destructuring-visitors');
<ide> var es6ObjectConciseMethod = require('jstransform/visitors/es6-object-concise-method-visitors');
<ide> var es6ObjectShortNotation = require('jstransform/visitors/es6-object-short-notation-visitors');
<ide> var es6RestParameters = require('jstransform/visitors/es6-rest-param-visitors');
<ide> var reactDisplayName = require('./transforms/reactDisplayName');
<ide> var transformVisitors = {
<ide> 'es6-arrow-functions': es6ArrowFunctions.visitorList,
<ide> 'es6-classes': es6Classes.visitorList,
<add> 'es6-destructuring': es6Destructuring.visitorList,
<ide> 'es6-object-concise-method': es6ObjectConciseMethod.visitorList,
<ide> 'es6-object-short-notation': es6ObjectShortNotation.visitorList,
<ide> 'es6-rest-params': es6RestParameters.visitorList,
<ide> var transformRunOrder = [
<ide> 'es6-classes',
<ide> 'es6-rest-params',
<ide> 'es6-templates',
<add> 'es6-destructuring',
<ide> 'react'
<ide> ];
<ide> | 1 |
Python | Python | remove redundant character escape from regex | 350fd627376b296aa70aea2481530336e6c71b06 | <ide><path>tests/test_utils/perf/dags/elastic_dag.py
<ide>
<ide> # DAG File used in performance tests. Its shape can be configured by environment variables.
<ide> RE_TIME_DELTA = re.compile(
<del> r"^((?P<days>[\.\d]+?)d)?((?P<hours>[\.\d]+?)h)?((?P<minutes>[\.\d]+?)m)?((?P<seconds>[\.\d]+?)s)?$"
<add> r"^((?P<days>[.\d]+?)d)?((?P<hours>[.\d]+?)h)?((?P<minutes>[.\d]+?)m)?((?P<seconds>[.\d]+?)s)?$"
<ide> )
<ide>
<ide>
<ide><path>tests/www/api/experimental/test_endpoints.py
<ide> def _setup_attrs_base(self, experiemental_api_app, configured_session):
<ide> def assert_deprecated(self, resp):
<ide> assert 'true' == resp.headers['Deprecation']
<ide> assert re.search(
<del> r'\<.+/upgrading-to-2.html#migration-guide-from-experimental-api-to-stable-api-v1\>; '
<add> r'<.+/upgrading-to-2.html#migration-guide-from-experimental-api-to-stable-api-v1>; '
<ide> 'rel="deprecation"; type="text/html"',
<ide> resp.headers['Link'],
<ide> ) | 2 |
Javascript | Javascript | add performance tracing for next-image-loader | 7c56684446173468acb8f0a910befe7a8c3d2360 | <ide><path>packages/next/build/webpack/loaders/next-image-loader.js
<ide> const BLUR_IMG_SIZE = 8
<ide> const BLUR_QUALITY = 70
<ide> const VALID_BLUR_EXT = ['jpeg', 'png', 'webp']
<ide>
<del>async function nextImageLoader(content) {
<del> const isServer = loaderUtils.getOptions(this).isServer
<del> const context = this.rootContext
<del> const opts = { context, content }
<del> const interpolatedName = loaderUtils.interpolateName(
<del> this,
<del> '/static/image/[path][name].[hash].[ext]',
<del> opts
<del> )
<del>
<del> let extension = loaderUtils.interpolateName(this, '[ext]', opts)
<del> if (extension === 'jpg') {
<del> extension = 'jpeg'
<del> }
<del>
<del> const imageSize = sizeOf(content)
<del> let blurDataURL
<del> if (VALID_BLUR_EXT.includes(extension)) {
<del> // Shrink the image's largest dimension
<del> const resizeOperationOpts =
<del> imageSize.width >= imageSize.height
<del> ? { type: 'resize', width: BLUR_IMG_SIZE }
<del> : { type: 'resize', height: BLUR_IMG_SIZE }
<del> const resizedImage = await processBuffer(
<del> content,
<del> [resizeOperationOpts],
<del> extension,
<del> BLUR_QUALITY
<add>function nextImageLoader(content) {
<add> const imageLoaderSpan = this.currentTraceSpan.traceChild('next-image-loader')
<add> return imageLoaderSpan.traceAsyncFn(async () => {
<add> const isServer = loaderUtils.getOptions(this).isServer
<add> const context = this.rootContext
<add> const opts = { context, content }
<add> const interpolatedName = loaderUtils.interpolateName(
<add> this,
<add> '/static/image/[path][name].[hash].[ext]',
<add> opts
<ide> )
<del> blurDataURL = `data:image/${extension};base64,${resizedImage.toString(
<del> 'base64'
<del> )}`
<del> }
<del>
<del> const stringifiedData = JSON.stringify({
<del> src: '/_next' + interpolatedName,
<del> height: imageSize.height,
<del> width: imageSize.width,
<del> blurDataURL,
<del> })
<ide>
<del> if (!isServer) {
<del> this.emitFile(interpolatedName, content, null)
<del> }
<add> let extension = loaderUtils.interpolateName(this, '[ext]', opts)
<add> if (extension === 'jpg') {
<add> extension = 'jpeg'
<add> }
<add>
<add> const imageSizeSpan = imageLoaderSpan.traceChild('image-size-calculation')
<add> const imageSize = imageSizeSpan.traceFn(() => sizeOf(content))
<add> let blurDataURL
<add> if (VALID_BLUR_EXT.includes(extension)) {
<add> // Shrink the image's largest dimension
<add> const resizeOperationOpts =
<add> imageSize.width >= imageSize.height
<add> ? { type: 'resize', width: BLUR_IMG_SIZE }
<add> : { type: 'resize', height: BLUR_IMG_SIZE }
<add>
<add> const resizeImageSpan = imageLoaderSpan.traceChild('image-resize')
<add> const resizedImage = await resizeImageSpan.traceAsyncFn(() =>
<add> processBuffer(content, [resizeOperationOpts], extension, BLUR_QUALITY)
<add> )
<add> const blurDataURLSpan = imageLoaderSpan.traceChild(
<add> 'image-base64-tostring'
<add> )
<add> blurDataURL = blurDataURLSpan.traceFn(
<add> () =>
<add> `data:image/${extension};base64,${resizedImage.toString('base64')}`
<add> )
<add> }
<ide>
<del> return `${'export default '} ${stringifiedData};`
<add> const stringifiedData = imageLoaderSpan
<add> .traceChild('image-data-stringify')
<add> .traceFn(() =>
<add> JSON.stringify({
<add> src: '/_next' + interpolatedName,
<add> height: imageSize.height,
<add> width: imageSize.width,
<add> blurDataURL,
<add> })
<add> )
<add>
<add> if (!isServer) {
<add> this.emitFile(interpolatedName, content, null)
<add> }
<add>
<add> return `export default ${stringifiedData};`
<add> })
<ide> }
<ide> export const raw = true
<ide> export default nextImageLoader | 1 |
Ruby | Ruby | cache the name and options on the stack | 32bacb1ce80a06f328a0f32ca27c07d8417704bc | <ide><path>activerecord/lib/active_record/associations/builder/collection_association.rb
<ide> def initialize(name, scope, options)
<ide>
<ide> def define_callbacks(model, reflection)
<ide> super
<add> name = reflection.name
<add> options = reflection.options
<ide> CALLBACKS.each { |callback_name|
<del> define_callback(model, callback_name, reflection.name, reflection.options)
<add> define_callback(model, callback_name, name, options)
<ide> }
<ide> end
<ide> | 1 |
Ruby | Ruby | follow code conventions on some tests | 21b61a8ac4dda12a4f429a50be3191aa967c10b3 | <ide><path>activemodel/test/cases/validations/conditional_validation_test.rb
<ide> def teardown
<ide>
<ide> def test_if_validation_using_method_true
<ide> # When the method returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => :condition_is_true )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :if => :condition_is_true )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_if_validation_using_method_true
<ide>
<ide> def test_unless_validation_using_method_true
<ide> # When the method returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => :condition_is_true )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :unless => :condition_is_true )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> assert t.errors[:title].empty?
<ide> end
<ide>
<ide> def test_if_validation_using_method_false
<ide> # When the method returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => :condition_is_true_but_its_not )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :if => :condition_is_true_but_its_not )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> assert t.errors[:title].empty?
<ide> end
<ide>
<ide> def test_unless_validation_using_method_false
<ide> # When the method returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => :condition_is_true_but_its_not )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :unless => :condition_is_true_but_its_not )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_unless_validation_using_method_false
<ide>
<ide> def test_if_validation_using_string_true
<ide> # When the evaluated string returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => "a = 1; a == 1" )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :if => "a = 1; a == 1" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_if_validation_using_string_true
<ide>
<ide> def test_unless_validation_using_string_true
<ide> # When the evaluated string returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => "a = 1; a == 1" )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :unless => "a = 1; a == 1" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> assert t.errors[:title].empty?
<ide> end
<ide>
<ide> def test_if_validation_using_string_false
<ide> # When the evaluated string returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :if => "false")
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :if => "false")
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> assert t.errors[:title].empty?
<ide> end
<ide>
<ide> def test_unless_validation_using_string_false
<ide> # When the evaluated string returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}", :unless => "false")
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}", :unless => "false")
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_unless_validation_using_string_false
<ide>
<ide> def test_if_validation_using_block_true
<ide> # When the block returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}",
<ide> :if => Proc.new { |r| r.content.size > 4 } )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> def test_if_validation_using_block_true
<ide>
<ide> def test_unless_validation_using_block_true
<ide> # When the block returns true
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}",
<ide> :unless => Proc.new { |r| r.content.size > 4 } )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> def test_unless_validation_using_block_true
<ide>
<ide> def test_if_validation_using_block_false
<ide> # When the block returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}",
<ide> :if => Proc.new { |r| r.title != "uhohuhoh"} )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.valid?
<ide> def test_if_validation_using_block_false
<ide>
<ide> def test_unless_validation_using_block_false
<ide> # When the block returns false
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}",
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}",
<ide> :unless => Proc.new { |r| r.title != "uhohuhoh"} )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide><path>activemodel/test/cases/validations/format_validation_test.rb
<ide> def test_validate_format
<ide> end
<ide>
<ide> def test_validate_format_with_allow_blank
<del> Topic.validates_format_of(:title, :with => /^Validation\smacros \w+!$/, :allow_blank=>true)
<add> Topic.validates_format_of(:title, :with => /^Validation\smacros \w+!$/, :allow_blank => true)
<ide> assert Topic.new("title" => "Shouldn't be valid").invalid?
<ide> assert Topic.new("title" => "").valid?
<ide> assert Topic.new("title" => nil).valid?
<ide><path>activemodel/test/cases/validations/inclusion_validation_test.rb
<ide> def test_validates_inclusion_of
<ide> end
<ide>
<ide> def test_validates_inclusion_of_with_allow_nil
<del> Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :allow_nil=>true )
<add> Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ), :allow_nil => true )
<ide>
<ide> assert Topic.new("title" => "a!", "content" => "abc").invalid?
<ide> assert Topic.new("title" => "", "content" => "abc").invalid?
<ide><path>activemodel/test/cases/validations/length_validation_test.rb
<ide> def teardown
<ide> end
<ide>
<ide> def test_validates_length_of_with_allow_nil
<del> Topic.validates_length_of( :title, :is => 5, :allow_nil=>true )
<add> Topic.validates_length_of( :title, :is => 5, :allow_nil => true )
<ide>
<ide> assert Topic.new("title" => "ab").invalid?
<ide> assert Topic.new("title" => "").invalid?
<ide> def test_validates_length_of_with_allow_nil
<ide> end
<ide>
<ide> def test_validates_length_of_with_allow_blank
<del> Topic.validates_length_of( :title, :is => 5, :allow_blank=>true )
<add> Topic.validates_length_of( :title, :is => 5, :allow_blank => true )
<ide>
<ide> assert Topic.new("title" => "ab").invalid?
<ide> assert Topic.new("title" => "").valid?
<ide> def test_validates_length_of_using_bignum
<ide> end
<ide>
<ide> def test_validates_length_of_nasty_params
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :is=>-6) }
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :within=>6) }
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :minimum=>"a") }
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :maximum=>"a") }
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :within=>"a") }
<del> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :is=>"a") }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :is => -6) }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :within => 6) }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :minimum => "a") }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :maximum => "a") }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :within => "a") }
<add> assert_raise(ArgumentError) { Topic.validates_length_of(:title, :is => "a") }
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_minimum_with_message
<del> Topic.validates_length_of( :title, :minimum=>5, :message=>"boo %{count}" )
<add> Topic.validates_length_of( :title, :minimum => 5, :message => "boo %{count}" )
<ide> t = Topic.new("title" => "uhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> assert_equal ["boo 5"], t.errors[:title]
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_minimum_with_too_short
<del> Topic.validates_length_of( :title, :minimum=>5, :too_short=>"hoo %{count}" )
<add> Topic.validates_length_of( :title, :minimum => 5, :too_short => "hoo %{count}" )
<ide> t = Topic.new("title" => "uhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> assert_equal ["hoo 5"], t.errors[:title]
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_maximum_with_message
<del> Topic.validates_length_of( :title, :maximum=>5, :message=>"boo %{count}" )
<add> Topic.validates_length_of( :title, :maximum => 5, :message => "boo %{count}" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_validates_length_of_custom_errors_for_in
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_maximum_with_too_long
<del> Topic.validates_length_of( :title, :maximum=>5, :too_long=>"hoo %{count}" )
<add> Topic.validates_length_of( :title, :maximum => 5, :too_long => "hoo %{count}" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_validates_length_of_custom_errors_for_both_too_short_and_too_long
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_is_with_message
<del> Topic.validates_length_of( :title, :is=>5, :message=>"boo %{count}" )
<add> Topic.validates_length_of( :title, :is => 5, :message => "boo %{count}" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> assert_equal ["boo 5"], t.errors["title"]
<ide> end
<ide>
<ide> def test_validates_length_of_custom_errors_for_is_with_wrong_length
<del> Topic.validates_length_of( :title, :is=>5, :wrong_length=>"hoo %{count}" )
<add> Topic.validates_length_of( :title, :is => 5, :wrong_length => "hoo %{count}" )
<ide> t = Topic.new("title" => "uhohuhoh", "content" => "whatever")
<ide> assert t.invalid?
<ide> assert t.errors[:title].any?
<ide> def test_validates_length_of_using_is_utf8
<ide> end
<ide>
<ide> def test_validates_length_of_with_block
<del> Topic.validates_length_of :content, :minimum => 5, :too_short=>"Your essay must be at least %{count} words.",
<add> Topic.validates_length_of :content, :minimum => 5, :too_short => "Your essay must be at least %{count} words.",
<ide> :tokenizer => lambda {|str| str.scan(/\w+/) }
<ide> t = Topic.new(:content => "this content should be long enough")
<ide> assert t.valid?
<ide><path>activeresource/test/cases/format_test.rb
<ide> def test_setting_format_before_site
<ide>
<ide> def test_serialization_of_nested_resource
<ide> address = { :street => '12345 Street' }
<del> person = { :name=> 'Rus', :address => address}
<add> person = { :name => 'Rus', :address => address}
<ide>
<ide> [:json, :xml].each do |format|
<ide> encoded_person = ActiveResource::Formats[format].encode(person) | 5 |
Python | Python | update encode documentation | 2e4de762318614878fc6fafd79cff73f3dcfca11 | <ide><path>src/transformers/tokenization_utils.py
<ide> def encode(
<ide> **kwargs
<ide> ):
<ide> """
<del> Converts a string in a sequence of ids (integer), using the tokenizer and vocabulary.
<add> Converts a string in a sequence of ids (integer), using the tokenizer and vocabulary. Adds the model-specific
<add> special tokens (such as beginning of sequence, end of sequence, sequence separator).
<ide>
<del> Same as doing ``self.convert_tokens_to_ids(self.tokenize(text))``.
<add> If specifying ``add_special_tokens=False``, same as doing ``self.convert_tokens_to_ids(self.tokenize(text))``.
<ide>
<ide> Args:
<ide> text (:obj:`str`, :obj:`List[str]` or :obj:`List[int]`): | 1 |
Javascript | Javascript | test hmac binding robustness | b4b37e8dc9e6469c21746fdb6738b8d0f4648f55 | <ide><path>test/parallel/test-crypto-hmac.js
<ide> if (!common.hasCrypto) {
<ide> }
<ide> const crypto = require('crypto');
<ide>
<add>// Test for binding layer robustness
<add>{
<add> const binding = process.binding('crypto');
<add> const h = new binding.Hmac();
<add> // Fail to init the Hmac with an algorithm.
<add> assert.throws(() => h.update('hello'), /^TypeError: HmacUpdate fail$/);
<add>}
<add>
<ide> // Test HMAC
<ide> const h1 = crypto.createHmac('sha1', 'Node')
<ide> .update('some data') | 1 |
Java | Java | change lift to use rx.observable.operator | 673b03c8127b5da4a57d86292782bd9f5ea9633e | <ide><path>rxjava-contrib/rxjava-debug/src/main/java/rx/operators/DebugSubscriber.java
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.plugins.DebugNotification;
<ide><path>rxjava-contrib/rxjava-debug/src/main/java/rx/plugins/DebugHook.java
<ide>
<ide> import rx.Observable;
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<ide> import rx.operators.DebugSubscriber;
<del>import rx.operators.Operator;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Actions;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-contrib/rxjava-debug/src/main/java/rx/plugins/DebugNotification.java
<ide>
<ide> import rx.Notification;
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.observers.SafeSubscriber;
<ide> import rx.operators.DebugSubscriber;
<del>import rx.operators.Operator;
<del>import rx.plugins.DebugNotification.Kind;
<ide>
<ide> public class DebugNotification<T> {
<ide> public static enum Kind {
<ide><path>rxjava-contrib/rxjava-debug/src/main/java/rx/plugins/NotificationEvent.java
<ide>
<ide> import rx.Notification;
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.observers.SafeSubscriber;
<ide> import rx.operators.DebugSubscriber;
<del>import rx.operators.Operator;
<ide>
<ide> public class NotificationEvent<T> {
<ide> public static enum Kind {
<ide><path>rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java
<ide>
<ide> import rx.Observable;
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<del>import rx.operators.Operator;
<ide> import rx.util.functions.Func1;
<ide> import rx.util.functions.Func2;
<ide>
<ide><path>rxjava-core/src/main/java/rx/Observable.java
<ide> import rx.operators.OperationToObservableFuture;
<ide> import rx.operators.OperationUsing;
<ide> import rx.operators.OperationWindow;
<del>import rx.operators.Operator;
<ide> import rx.operators.OperatorCast;
<ide> import rx.operators.OperatorDoOnEach;
<ide> import rx.operators.OperatorFilter;
<ide> * {@link OnSubscribe} to be executed when {@link #subscribe(Subscriber)} is called
<ide> */
<ide> protected Observable(OnSubscribe<T> f) {
<del> this.f = f;
<add> this.f = hook.onCreate(f);
<ide> }
<ide>
<ide> private final static RxJavaObservableExecutionHook hook = RxJavaPlugins.getInstance().getObservableExecutionHook();
<ide> protected Observable(OnSubscribe<T> f) {
<ide> * @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.create.aspx">MSDN: Observable.Create</a>
<ide> */
<ide> public final static <T> Observable<T> create(OnSubscribe<T> f) {
<del> return new Observable<T>(hook.onCreate(f));
<add> return new Observable<T>(f);
<ide> }
<ide>
<ide> /**
<del> *
<add> * Invoked when Obserable.subscribe is called.
<ide> */
<ide> public static interface OnSubscribe<T> extends Action1<Subscriber<? super T>> {
<del>
<add> // cover for generics insanity
<ide> }
<add>
<add> /**
<add> * Operator function for lifting into an Observable.
<add> */
<add> public interface Operator<R, T> extends Func1<Subscriber<? super R>, Subscriber<? super T>> {
<add> // cover for generics insanity
<add> }
<add>
<ide>
<ide> /**
<del> *
<add> * @Deprecated
<ide> */
<add> @Deprecated
<ide> public final static <T> Observable<T> create(final OnSubscribeFunc<T> f) {
<ide> return new Observable<T>(new OnSubscribe<T>() {
<ide>
<ide> public void call(Subscriber<? super T> observer) {
<ide> * @param bind
<ide> * @return an Observable that emits values that are the result of applying the bind function to the values of the current Observable
<ide> */
<del> public <R> Observable<R> lift(final Func1<Subscriber<? super R>, Subscriber<? super T>> bind) {
<add> public <R> Observable<R> lift(final Operator<R, T> bind) {
<ide> return new Observable<R>(new OnSubscribe<R>() {
<ide> @Override
<ide> public void call(Subscriber<? super R> o) {
<del> subscribe(hook.onLift((Operator<R, T>) bind).call(o));
<add> subscribe(hook.onLift(bind).call(o));
<ide> }
<ide> });
<ide> }
<ide><path>rxjava-core/src/main/java/rx/joins/JoinObserver1.java
<ide> import rx.Observable;
<ide> import rx.Subscriber;
<ide> import rx.observers.SafeSubscriber;
<del>import rx.operators.SafeObservableSubscription;
<ide> import rx.util.functions.Action1;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/observables/BlockingObservable.java
<ide> import rx.operators.OperationNext;
<ide> import rx.operators.OperationToFuture;
<ide> import rx.operators.OperationToIterator;
<del>import rx.operators.SafeObservableSubscription;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func1;
<ide>
<ide><path>rxjava-core/src/main/java/rx/observers/Observers.java
<ide> package rx.observers;
<ide>
<ide> import rx.Observer;
<del>import rx.Subscriber;
<ide> import rx.util.OnErrorNotImplementedException;
<ide> import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide><path>rxjava-core/src/main/java/rx/observers/TestObserver.java
<ide> package rx.observers;
<ide>
<ide> import java.util.ArrayList;
<del>import java.util.Arrays;
<ide> import java.util.Collections;
<ide> import java.util.List;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/ChunkedOperation.java
<ide> import rx.Scheduler;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscription;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func0;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-core/src/main/java/rx/operators/OperationDebounce.java
<ide> import rx.schedulers.Schedulers;
<ide> import rx.subscriptions.CompositeSubscription;
<ide> import rx.subscriptions.SerialSubscription;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func1;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperationDelay.java
<ide> import rx.subscriptions.CompositeSubscription;
<ide> import rx.subscriptions.SerialSubscription;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func0;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-core/src/main/java/rx/operators/OperationMergeDelayError.java
<ide> import rx.observers.SynchronizedObserver;
<ide> import rx.subscriptions.BooleanSubscription;
<ide> import rx.subscriptions.CompositeSubscription;
<del>import rx.subscriptions.Subscriptions;
<ide> import rx.util.CompositeException;
<del>import rx.util.functions.Action0;
<ide>
<ide> /**
<ide> * This behaves like {@link OperatorMerge} except that if any of the merged Observables notify of
<ide><path>rxjava-core/src/main/java/rx/operators/OperationSkip.java
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscription;
<ide> import rx.subscriptions.CompositeSubscription;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/operators/OperationTakeTimed.java
<ide> import rx.Subscription;
<ide> import rx.subscriptions.CompositeSubscription;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/operators/OperationTimer.java
<ide> import rx.Scheduler;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscription;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/operators/Operator.java
<del>package rx.operators;
<del>
<del>import rx.Subscriber;
<del>import rx.util.functions.Func1;
<del>
<del>public interface Operator<R, T> extends Func1<Subscriber<? super R>, Subscriber<? super T>> {
<del>
<del>}
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorCast.java
<ide> */
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide>
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorDoOnEach.java
<ide> */
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorFilter.java
<ide> */
<ide> package rx.operators;
<ide>
<del>import rx.Observable;
<del>import rx.Observable.OnSubscribeFunc;
<del>import rx.Observer;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<del>import rx.Subscription;
<ide> import rx.observables.GroupedObservable;
<ide> import rx.util.functions.Func1;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorGroupBy.java
<ide> import java.util.concurrent.atomic.AtomicInteger;
<ide>
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.observables.GroupedObservable;
<ide> import rx.subjects.PublishSubject;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorMap.java
<ide> */
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.util.functions.Func1;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorMerge.java
<ide> import java.util.concurrent.atomic.AtomicInteger;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.observers.SynchronizedSubscriber;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorObserveOn.java
<ide> import java.util.concurrent.Semaphore;
<ide> import java.util.concurrent.atomic.AtomicLong;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Scheduler;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscriber;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorParallel.java
<ide> package rx.operators;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Scheduler;
<ide> import rx.Subscriber;
<ide> import rx.observables.GroupedObservable;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorRepeat.java
<ide> package rx.operators;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Scheduler;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscriber;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorSubscribeOn.java
<ide> package rx.operators;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Scheduler;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscriber;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorTake.java
<ide> */
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.subscriptions.CompositeSubscription;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorTimeoutBase.java
<ide> import java.util.concurrent.atomic.AtomicLong;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<ide> import rx.observers.SynchronizedSubscriber;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorTimestamp.java
<ide> */
<ide> package rx.operators;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Scheduler;
<ide> import rx.Subscriber;
<ide> import rx.util.Timestamped;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorToObservableList.java
<ide> import java.util.ArrayList;
<ide> import java.util.List;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorToObservableSortedList.java
<ide> import java.util.Comparator;
<ide> import java.util.List;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.util.functions.Func2;
<ide>
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorZip.java
<ide> import java.util.concurrent.atomic.AtomicLong;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.subscriptions.CompositeSubscription;
<ide><path>rxjava-core/src/main/java/rx/operators/OperatorZipIterable.java
<ide>
<ide> import java.util.Iterator;
<ide>
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.observers.Subscribers;
<ide> import rx.util.functions.Func2;
<ide><path>rxjava-core/src/main/java/rx/operators/SafeObserver.java
<ide>
<ide> import rx.Observer;
<ide> import rx.Subscription;
<add>import rx.observers.SynchronizedObserver;
<ide> import rx.plugins.RxJavaPlugins;
<ide> import rx.subscriptions.Subscriptions;
<ide> import rx.util.CompositeException;
<ide><path>rxjava-core/src/main/java/rx/plugins/RxJavaObservableExecutionHook.java
<ide> import rx.Observable;
<ide> import rx.Observable.OnSubscribe;
<ide> import rx.Observable.OnSubscribeFunc;
<add>import rx.Observable.Operator;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<del>import rx.operators.Operator;
<ide> import rx.util.functions.Func1;
<ide>
<ide> /**
<ide><path>rxjava-core/src/main/java/rx/subjects/SubjectSubscriptionManager.java
<ide> import java.util.concurrent.CountDownLatch;
<ide> import java.util.concurrent.atomic.AtomicReference;
<ide>
<add>import rx.Observable.OnSubscribe;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<del>import rx.Observable.OnSubscribe;
<ide> import rx.operators.SafeObservableSubscription;
<ide> import rx.subscriptions.Subscriptions;
<ide> import rx.util.functions.Action0;
<ide><path>rxjava-core/src/main/java/rx/subscriptions/CompositeSubscription.java
<ide> package rx.subscriptions;
<ide>
<ide> import java.util.ArrayList;
<del>import java.util.Arrays;
<ide> import java.util.List;
<ide> import java.util.concurrent.atomic.AtomicReference;
<ide>
<ide><path>rxjava-core/src/perf/java/rx/operators/ObservableBenchmark.java
<ide>
<ide> import rx.Observable;
<ide> import rx.Observable.OnSubscribe;
<add>import rx.Observable.Operator;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-core/src/test/java/rx/observers/SynchronizedObserverTest.java
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<del>import rx.operators.SafeObservableSubscription;
<del>import rx.operators.SafeObserver;
<ide>
<ide> public class SynchronizedObserverTest {
<ide>
<ide><path>rxjava-core/src/test/java/rx/operators/OperationBufferTest.java
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func0;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-core/src/test/java/rx/operators/OperationDebounceTest.java
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func1;
<ide>
<ide><path>rxjava-core/src/test/java/rx/operators/OperationSampleTest.java
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide>
<ide> public class OperationSampleTest {
<ide><path>rxjava-core/src/test/java/rx/operators/OperationSwitchTest.java
<ide> import rx.Subscription;
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide>
<ide> public class OperationSwitchTest {
<ide><path>rxjava-core/src/test/java/rx/operators/OperationWindowTest.java
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide> import rx.subscriptions.Subscriptions;
<del>import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1;
<ide> import rx.util.functions.Func0;
<ide> import rx.util.functions.Func1;
<ide><path>rxjava-core/src/test/java/rx/operators/OperatorFromIterableTest.java
<ide> */
<ide> package rx.operators;
<ide>
<del>import static org.mockito.Matchers.any;
<del>import static org.mockito.Mockito.mock;
<del>import static org.mockito.Mockito.times;
<del>import static org.mockito.Mockito.verify;
<add>import static org.mockito.Matchers.*;
<add>import static org.mockito.Mockito.*;
<ide>
<ide> import java.util.Arrays;
<ide>
<ide><path>rxjava-core/src/test/java/rx/operators/OperatorSubscribeOnTest.java
<ide> */
<ide> package rx.operators;
<ide>
<del>import static org.junit.Assert.assertEquals;
<del>import static org.junit.Assert.assertNotNull;
<del>import static org.junit.Assert.assertNotSame;
<del>import static org.junit.Assert.assertTrue;
<add>import static org.junit.Assert.*;
<ide>
<ide> import java.util.Arrays;
<ide> import java.util.concurrent.CountDownLatch;
<ide><path>rxjava-core/src/test/java/rx/operators/OperatorTakeTest.java
<ide> package rx.operators;
<ide>
<ide> import static org.junit.Assert.*;
<add>import static org.mockito.Matchers.*;
<ide> import static org.mockito.Mockito.*;
<ide>
<ide> import java.util.Arrays;
<ide><path>rxjava-core/src/test/java/rx/operators/OperatorTimeoutTests.java
<ide> */
<ide> package rx.operators;
<ide>
<del>import static org.mockito.Matchers.any;
<del>import static org.mockito.Matchers.isA;
<del>import static org.mockito.Mockito.inOrder;
<del>import static org.mockito.Mockito.mock;
<del>import static org.mockito.Mockito.never;
<del>import static org.mockito.Mockito.times;
<del>import static org.mockito.Mockito.verify;
<add>import static org.mockito.Matchers.*;
<add>import static org.mockito.Mockito.*;
<ide>
<ide> import java.util.concurrent.CountDownLatch;
<ide> import java.util.concurrent.TimeUnit;
<ide> import org.mockito.MockitoAnnotations;
<ide>
<ide> import rx.Observable;
<add>import rx.Observable.OnSubscribe;
<ide> import rx.Observer;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<del>import rx.Observable.OnSubscribe;
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide>
<ide><path>rxjava-core/src/test/java/rx/operators/OperatorTimeoutWithSelectorTest.java
<ide> */
<ide> package rx.operators;
<ide>
<del>import static org.mockito.Matchers.any;
<del>import static org.mockito.Matchers.isA;
<del>import static org.mockito.Mockito.doAnswer;
<del>import static org.mockito.Mockito.inOrder;
<del>import static org.mockito.Mockito.mock;
<del>import static org.mockito.Mockito.never;
<del>import static org.mockito.Mockito.verify;
<add>import static org.mockito.Matchers.*;
<add>import static org.mockito.Mockito.*;
<ide>
<ide> import java.util.Arrays;
<ide> import java.util.concurrent.CountDownLatch;
<ide><path>rxjava-core/src/test/java/rx/schedulers/AbstractSchedulerTests.java
<ide> import static org.mockito.Mockito.*;
<ide>
<ide> import java.util.Arrays;
<del>import java.util.Date;
<ide> import java.util.List;
<ide> import java.util.concurrent.CountDownLatch;
<ide> import java.util.concurrent.TimeUnit;
<ide> import rx.Scheduler.Inner;
<ide> import rx.Subscriber;
<ide> import rx.Subscription;
<del>import rx.subscriptions.BooleanSubscription;
<ide> import rx.subscriptions.Subscriptions;
<ide> import rx.util.functions.Action0;
<ide> import rx.util.functions.Action1; | 52 |
Javascript | Javascript | fix fd leak in readstream.destroy() | 497fd72e21d2d1216e8457928d1a8082349fd0e5 | <ide><path>lib/fs.js
<ide> ReadStream.prototype.destroy = function() {
<ide> if (this.destroyed)
<ide> return;
<ide> this.destroyed = true;
<del>
<del> if (util.isNumber(this.fd))
<del> this.close();
<add> this.close();
<ide> };
<ide>
<ide> | 1 |
Go | Go | convert tarappender to the newidmappings | 5672eeb5e06fe96451f36f35be7cfa18a4cf5063 | <ide><path>pkg/archive/archive.go
<ide> type tarAppender struct {
<ide> Buffer *bufio.Writer
<ide>
<ide> // for hardlink mapping
<del> SeenFiles map[uint64]string
<del> UIDMaps []idtools.IDMap
<del> GIDMaps []idtools.IDMap
<add> SeenFiles map[uint64]string
<add> IDMappings *idtools.IDMappings
<ide>
<ide> // For packing and unpacking whiteout files in the
<ide> // non standard format. The whiteout files defined
<ide> type tarAppender struct {
<ide> WhiteoutConverter tarWhiteoutConverter
<ide> }
<ide>
<add>func newTarAppender(idMapping *idtools.IDMappings, writer io.Writer) *tarAppender {
<add> return &tarAppender{
<add> SeenFiles: make(map[uint64]string),
<add> TarWriter: tar.NewWriter(writer),
<add> Buffer: pools.BufioWriter32KPool.Get(nil),
<add> IDMappings: idMapping,
<add> }
<add>}
<add>
<ide> // canonicalTarName provides a platform-independent and consistent posix-style
<ide> //path for files and directories to be archived regardless of the platform.
<ide> func canonicalTarName(name string, isDir bool) (string, error) {
<ide> func (ta *tarAppender) addTarFile(path, name string) error {
<ide> //handle re-mapping container ID mappings back to host ID mappings before
<ide> //writing tar headers/files. We skip whiteout files because they were written
<ide> //by the kernel and already have proper ownership relative to the host
<del> if !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && (ta.UIDMaps != nil || ta.GIDMaps != nil) {
<add> if !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && !ta.IDMappings.Empty() {
<ide> uid, gid, err := getFileUIDGID(fi.Sys())
<ide> if err != nil {
<ide> return err
<ide> }
<del> xUID, err := idtools.ToContainer(uid, ta.UIDMaps)
<add> hdr.Uid, err = ta.IDMappings.UIDToContainer(uid)
<ide> if err != nil {
<ide> return err
<ide> }
<del> xGID, err := idtools.ToContainer(gid, ta.GIDMaps)
<add> hdr.Gid, err = ta.IDMappings.GIDToContainer(gid)
<ide> if err != nil {
<ide> return err
<ide> }
<del> hdr.Uid = xUID
<del> hdr.Gid = xGID
<ide> }
<ide>
<ide> if ta.WhiteoutConverter != nil {
<ide> func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
<ide> }
<ide>
<ide> go func() {
<del> ta := &tarAppender{
<del> TarWriter: tar.NewWriter(compressWriter),
<del> Buffer: pools.BufioWriter32KPool.Get(nil),
<del> SeenFiles: make(map[uint64]string),
<del> UIDMaps: options.UIDMaps,
<del> GIDMaps: options.GIDMaps,
<del> WhiteoutConverter: getWhiteoutConverter(options.WhiteoutFormat),
<del> }
<add> ta := newTarAppender(
<add> idtools.NewIDMappingsFromMaps(options.UIDMaps, options.GIDMaps),
<add> compressWriter,
<add> )
<add> ta.WhiteoutConverter = getWhiteoutConverter(options.WhiteoutFormat)
<ide>
<ide> defer func() {
<ide> // Make sure to check the error on Close.
<ide><path>pkg/archive/changes.go
<ide> func ChangesSize(newDir string, changes []Change) int64 {
<ide> func ExportChanges(dir string, changes []Change, uidMaps, gidMaps []idtools.IDMap) (io.ReadCloser, error) {
<ide> reader, writer := io.Pipe()
<ide> go func() {
<del> ta := &tarAppender{
<del> TarWriter: tar.NewWriter(writer),
<del> Buffer: pools.BufioWriter32KPool.Get(nil),
<del> SeenFiles: make(map[uint64]string),
<del> UIDMaps: uidMaps,
<del> GIDMaps: gidMaps,
<del> }
<add> ta := newTarAppender(idtools.NewIDMappingsFromMaps(uidMaps, gidMaps), writer)
<add>
<ide> // this buffer is needed for the duration of this piped stream
<ide> defer pools.BufioWriter32KPool.Put(ta.Buffer)
<ide>
<ide><path>pkg/idtools/idtools.go
<ide> func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) {
<ide> return uid, gid, nil
<ide> }
<ide>
<del>// ToContainer takes an id mapping, and uses it to translate a
<add>// toContainer takes an id mapping, and uses it to translate a
<ide> // host ID to the remapped ID. If no map is provided, then the translation
<ide> // assumes a 1-to-1 mapping and returns the passed in id
<del>func ToContainer(hostID int, idMap []IDMap) (int, error) {
<add>func toContainer(hostID int, idMap []IDMap) (int, error) {
<ide> if idMap == nil {
<ide> return hostID, nil
<ide> }
<ide> func NewIDMappings(username, groupname string) (*IDMappings, error) {
<ide> }, nil
<ide> }
<ide>
<add>// NewIDMappingsFromMaps creates a new mapping from two slices
<add>// Deprecated: this is a temporary shim while transitioning to IDMapping
<add>func NewIDMappingsFromMaps(uids []IDMap, gids []IDMap) *IDMappings {
<add> return &IDMappings{uids: uids, gids: gids}
<add>}
<add>
<ide> // RootPair returns a uid and gid pair for the root user
<ide> func (i *IDMappings) RootPair() (IDPair, error) {
<ide> uid, gid, err := GetRootUIDGID(i.uids, i.gids)
<ide> func (i *IDMappings) GIDToHost(gid int) (int, error) {
<ide> return ToHost(gid, i.gids)
<ide> }
<ide>
<add>// UIDToContainer returns the container UID for the host uid
<add>func (i *IDMappings) UIDToContainer(uid int) (int, error) {
<add> return toContainer(uid, i.uids)
<add>}
<add>
<add>// GIDToContainer returns the container GID for the host gid
<add>func (i *IDMappings) GIDToContainer(gid int) (int, error) {
<add> return toContainer(gid, i.gids)
<add>}
<add>
<add>// Empty returns true if there are no id mappings
<add>func (i *IDMappings) Empty() bool {
<add> return len(i.uids) == 0 && len(i.gids) == 0
<add>}
<add>
<ide> // UIDs return the UID mapping
<ide> // TODO: remove this once everything has been refactored to use pairs
<ide> func (i *IDMappings) UIDs() []IDMap { | 3 |
Ruby | Ruby | convert source to string if it is present | d28ed9f5360b54320b2d1baaa2e6d0e3f3f941fc | <ide><path>actionview/lib/action_view/helpers/asset_url_helper.rb
<ide> module AssetUrlHelper
<ide> # asset_path "application", type: :stylesheet # => /stylesheets/application.css
<ide> # asset_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
<ide> def asset_path(source, options = {})
<del> source = source.to_s
<ide> return "" unless source.present?
<add> source = source.to_s
<ide> return source if source =~ URI_REGEXP
<ide>
<ide> tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '') | 1 |
Ruby | Ruby | use a conditional rather than early return in `id` | 607e335faeeab965d2ba28a7ca2cbb19e2878c62 | <ide><path>activerecord/lib/active_record/attribute_methods/primary_key.rb
<ide> def to_key
<ide>
<ide> # Returns the primary key value.
<ide> def id
<del> return unless self.class.primary_key
<del> sync_with_transaction_state
<del> read_attribute(self.class.primary_key)
<add> if pk = self.class.primary_key
<add> sync_with_transaction_state
<add> read_attribute(pk)
<add> end
<ide> end
<ide>
<ide> # Sets the primary key value. | 1 |
Javascript | Javascript | organize sequence.js a bit, use #pragma | 1423ade39a2162aeee13fb8ac758aef95f65770b | <ide><path>dist/Immutable.js
<ide> var IndexedSequencePrototype = IndexedSequence.prototype;
<ide> IndexedSequencePrototype[ITERATOR_SYMBOL] = IndexedSequencePrototype.values;
<ide> IndexedSequencePrototype.__toJS = IndexedSequencePrototype.toArray;
<ide> IndexedSequencePrototype.__toStringMapper = quoteString;
<del>var ValuesSequence = function ValuesSequence(seq) {
<del> this._seq = seq;
<del> this.length = seq.length;
<del>};
<del>($traceurRuntime.createClass)(ValuesSequence, {
<del> get: function(key, notSetValue) {
<del> return this._seq.get(key, notSetValue);
<del> },
<del> has: function(key) {
<del> return this._seq.has(key);
<del> },
<del> cacheResult: function() {
<del> this._seq.cacheResult();
<del> this.length = this._seq.length;
<del> return this;
<del> },
<del> __iterate: function(fn, reverse) {
<del> var $__0 = this;
<del> var iterations = 0;
<del> return this._seq.__iterate((function(v) {
<del> return fn(v, iterations++, $__0);
<del> }), reverse);
<del> },
<del> __iterator: function(type, reverse) {
<del> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<del> var iterations = 0;
<del> var step;
<del> return new Iterator((function() {
<del> return (step = iterator.next()).done ? iteratorDone() : iteratorValue(type, iterations++, step.value);
<del> }));
<del> }
<del>}, {}, IndexedSequence);
<del>var KeyedIndexedSequence = function KeyedIndexedSequence(indexedSeq) {
<del> this._seq = indexedSeq;
<del> this.length = indexedSeq.length;
<del>};
<del>($traceurRuntime.createClass)(KeyedIndexedSequence, {
<del> get: function(key, notSetValue) {
<del> return this._seq.get(key, notSetValue);
<del> },
<del> has: function(key) {
<del> return this._seq.has(key);
<del> },
<del> valueSeq: function() {
<del> return this._seq;
<del> },
<del> reverse: function() {
<del> var $__0 = this;
<del> var reversedSequence = reverseFactory(this);
<del> reversedSequence.valueSeq = (function() {
<del> return $__0._seq.reverse();
<del> });
<del> return reversedSequence;
<del> },
<del> map: function(mapper, context) {
<del> var $__0 = this;
<del> var mappedSequence = mapFactory(this, mapper, context);
<del> mappedSequence.valueSeq = (function() {
<del> return $__0._seq.map(mapper, context);
<del> });
<del> return mappedSequence;
<del> },
<del> cacheResult: function() {
<del> this._seq.cacheResult();
<del> this.length = this._seq.length;
<del> return this;
<del> },
<del> __iterate: function(fn, reverse) {
<del> var $__0 = this;
<del> var ii = reverse ? ensureLength(this) : 0;
<del> return this._seq.__iterate((function(v) {
<del> return fn(v, reverse ? --ii : ii++, $__0);
<del> }), reverse);
<del> },
<del> __iterator: function(type, reverse) {
<del> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<del> var ii = reverse ? ensureLength(this) : 0;
<del> return new Iterator((function() {
<del> var step = iterator.next();
<del> return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value);
<del> }));
<del> }
<del>}, {}, Sequence);
<ide> var IteratorSequence = function IteratorSequence(iterator) {
<ide> this._iterator = iterator;
<ide> this._iteratorCache = [];
<ide> function entryMapper(v, k) {
<ide> function returnTrue() {
<ide> return true;
<ide> }
<add>function not(predicate) {
<add> return function() {
<add> return !predicate.apply(this, arguments);
<add> };
<add>}
<add>function quoteString(value) {
<add> return typeof value === 'string' ? JSON.stringify(value) : value;
<add>}
<add>function defaultComparator(a, b) {
<add> return a > b ? 1 : a < b ? -1 : 0;
<add>}
<add>function wrapIndex(seq, index) {
<add> if (index < 0) {
<add> if (seq.length == null) {
<add> seq.cacheResult();
<add> }
<add> return seq.length + index;
<add> }
<add> return index;
<add>}
<add>function assertNotInfinite(length) {
<add> invariant(length !== Infinity, 'Cannot perform this action with an infinite sequence.');
<add>}
<ide> function iterate(sequence, fn, reverse, useKeys) {
<ide> var cache = sequence._cache;
<ide> if (cache) {
<ide> function iterator(sequence, type, reverse, useKeys) {
<ide> }
<ide> return sequence.__iteratorUncached(type, reverse);
<ide> }
<add>var ValuesSequence = function ValuesSequence(seq) {
<add> this._seq = seq;
<add> this.length = seq.length;
<add>};
<add>($traceurRuntime.createClass)(ValuesSequence, {
<add> get: function(key, notSetValue) {
<add> return this._seq.get(key, notSetValue);
<add> },
<add> has: function(key) {
<add> return this._seq.has(key);
<add> },
<add> cacheResult: function() {
<add> this._seq.cacheResult();
<add> this.length = this._seq.length;
<add> return this;
<add> },
<add> __iterate: function(fn, reverse) {
<add> var $__0 = this;
<add> var iterations = 0;
<add> return this._seq.__iterate((function(v) {
<add> return fn(v, iterations++, $__0);
<add> }), reverse);
<add> },
<add> __iterator: function(type, reverse) {
<add> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<add> var iterations = 0;
<add> var step;
<add> return new Iterator((function() {
<add> return (step = iterator.next()).done ? iteratorDone() : iteratorValue(type, iterations++, step.value);
<add> }));
<add> }
<add>}, {}, IndexedSequence);
<add>var KeyedIndexedSequence = function KeyedIndexedSequence(indexedSeq) {
<add> this._seq = indexedSeq;
<add> this.length = indexedSeq.length;
<add>};
<add>($traceurRuntime.createClass)(KeyedIndexedSequence, {
<add> get: function(key, notSetValue) {
<add> return this._seq.get(key, notSetValue);
<add> },
<add> has: function(key) {
<add> return this._seq.has(key);
<add> },
<add> valueSeq: function() {
<add> return this._seq;
<add> },
<add> reverse: function() {
<add> var $__0 = this;
<add> var reversedSequence = reverseFactory(this);
<add> reversedSequence.valueSeq = (function() {
<add> return $__0._seq.reverse();
<add> });
<add> return reversedSequence;
<add> },
<add> map: function(mapper, context) {
<add> var $__0 = this;
<add> var mappedSequence = mapFactory(this, mapper, context);
<add> mappedSequence.valueSeq = (function() {
<add> return $__0._seq.map(mapper, context);
<add> });
<add> return mappedSequence;
<add> },
<add> cacheResult: function() {
<add> this._seq.cacheResult();
<add> this.length = this._seq.length;
<add> return this;
<add> },
<add> __iterate: function(fn, reverse) {
<add> var $__0 = this;
<add> var ii = reverse ? ensureLength(this) : 0;
<add> return this._seq.__iterate((function(v) {
<add> return fn(v, reverse ? --ii : ii++, $__0);
<add> }), reverse);
<add> },
<add> __iterator: function(type, reverse) {
<add> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<add> var ii = reverse ? ensureLength(this) : 0;
<add> return new Iterator((function() {
<add> var step = iterator.next();
<add> return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value);
<add> }));
<add> }
<add>}, {}, Sequence);
<ide> function flipFactory(sequence) {
<ide> var flipSequence = sequence.__makeSequence();
<ide> flipSequence.length = sequence.length;
<ide> function flattenFactory(sequence, useKeys) {
<ide> };
<ide> return flatSequence;
<ide> }
<del>function not(predicate) {
<del> return function() {
<del> return !predicate.apply(this, arguments);
<del> };
<del>}
<del>function quoteString(value) {
<del> return typeof value === 'string' ? JSON.stringify(value) : value;
<del>}
<del>function defaultComparator(a, b) {
<del> return a > b ? 1 : a < b ? -1 : 0;
<del>}
<del>function wrapIndex(seq, index) {
<del> if (index < 0) {
<del> if (seq.length == null) {
<del> seq.cacheResult();
<del> }
<del> return seq.length + index;
<del> }
<del> return index;
<del>}
<del>function assertNotInfinite(length) {
<del> invariant(length !== Infinity, 'Cannot perform this action with an infinite sequence.');
<del>}
<ide> var Cursor = function Cursor(rootData, keyPath, onChange, value) {
<ide> value = value ? value : rootData.getIn(keyPath);
<ide> this.length = value instanceof Sequence ? value.length : null;
<ide><path>dist/Immutable.min.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> */
<ide> function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=Ce.create(u)}else i=t.prototype;return Ce.keys(e).forEach(function(t){i[t]=e[t]}),Ce.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return Ce.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function a(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function s(t,e){if(!t)throw Error(e)}function o(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Be;t=""+t,e="string"}return"string"===e?t.length>Ne?h(t):c(t):t.hashCode?o("function"==typeof t.hashCode?t.hashCode():t.hashCode):f(t)}function h(t){var e=Ge[t];return null==e&&(e=c(t),Fe===Te&&(Fe=0,Ge={}),Fe++,Ge[t]=e),e}function c(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&Be;return e}function f(t){var e=t[Ve];if(e)return e;if(!Je){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Ve])return e;if(e=_(t))return e}if(!Je||Object.isExtensible(t)){if(e=++Le&Be,Je)Object.defineProperty(t,Ve,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(ze&&t.propertyIsEnumerable===ze)t.propertyIsEnumerable=function(){return ze.apply(this,arguments)},t.propertyIsEnumerable[Ve]=e;else{if(!t.nodeType)throw Error("Unable to set a non-enumerable property on object.");t[Ve]=e}return e}throw Error("Non-extensible objects are not allowed as keys.")}function _(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function l(t,e,r){return er.value=0===t?e:1===t?r:[e,r],er.done=!1,er}function v(){return er.value=void 0,er.done=!0,er}function g(t,e){var r=new $e;return r.next=function(){var r=t.next();return r.done?r:(r.value=e(r.value),r)},r}function p(t){return!!d(t)}function m(t){return t&&"function"==typeof t.next}function y(t){var e=d(t);return"function"==typeof e?e.call(t):void 0}function d(t){return t&&(t[Ze]||t[Ye])
<del>}function w(){return Object.create(ir)}function S(){return Object.create(sr)}function q(t){return null==t.length&&t.cacheResult(),s(1/0>t.length,"Cannot reverse infinite range."),t.length}function b(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function I(t,e){return k(t,e,0)}function M(t,e){return k(t,e,e)}function k(t,e,r){return null==t?r:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function D(t){return t}function x(t,e){return[e,t]}function O(){return!0}function C(t,e,r,n){var i=t._cache;if(i){for(var u=i.length-1,a=0;u>=a;a++){var s=i[r?u-a:a];if(e(s[1],n?s[0]:a,t)===!1)return a+1}return a}return t.__iterateUncached(e,r)}function A(t,e,r,n){var i=t._cache;if(i){var u=i.length-1,a=0;return new $e(function(){var t=i[r?u-a:a];return a++>u?v():l(e,n?t[0]:a-1,t[1])})}return t.__iteratorUncached?t.__iteratorUncached(e,r):t.cacheResult().__iterator(e,r)}function E(t){var e=t.__makeSequence();return e.length=t.length,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.contains(e)},e.contains=function(e){return t.has(e)},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e}function j(t,e,r){var n=t.__makeSequence();return n.length=t.length,n.has=function(e){return t.has(e)},n.get=function(n,i){var u=t.get(n,Pe);return u===Pe?i:e.call(r,u,n,t)},n.__iterateUncached=function(n,i){var u=this;return t.__iterate(function(t,i,a){return n(e.call(r,t,i,a),i,u)!==!1},i)},n.__iteratorUncached=function(n,i){var u=t.__iterator(Xe,i);return new $e(function(){var i=u.next();if(i.done)return i;var a=i.value,s=a[0];return l(n,s,e.call(r,a[1],s,t))})},n}function R(t){var e=t.__makeSequence();return e.length=t.length,e.reverse=function(){return t},e.flip=function(){var e=t.flip.apply(this);return e.reverse=function(){return t.flip()},e},e.get=function(e,r){return t.get(e,r)},e.has=function(e){return t.has(e)},e.contains=function(e){return t.contains(e)},e.cacheResult=function(){return t.cacheResult(),this.length=t.length,this
<del>},e.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},e.__iterator=function(e,r){return t.__iterator(e,!r)},e}function U(t,e,r,n){var i=t.__makeSequence();return i.has=function(n){var i=t.get(n,Pe);return i!==Pe&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,Pe);return u!==Pe&&e.call(r,u,n,t)?u:i},i.__iterateUncached=function(i,u){var a=this,s=0;return t.__iterate(function(t,u,o){return e.call(r,t,u,o)?(s++,i(t,n?u:s-1,a)):void 0},u),s},i.__iteratorUncached=function(i,u){var a=t.__iterator(Xe,u),s=0;return new $e(function(){for(;;){var u=a.next();if(u.done)return u;var o=u.value,h=o[0],c=o[1];if(e.call(r,c,h,t))return l(i,n?h:s++,c)}})},i}function P(t,e,r,n){var i={},u=[];return t.__iterate(function(a,s){var h=e.call(r,a,s,t),c=o(h),f=n?[s,a]:a;i.hasOwnProperty(c)?u[i[c]][1].push(f):(i[c]=u.length,u.push([h,[f]]))}),rr(u).fromEntrySeq().map(n?function(t){return rr(t).fromEntrySeq()}:function(t){return rr(t)})}function W(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.length=t.length&&Math.max(0,t.length-e),n}function K(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i}function z(t,e,r){var n=[t].concat(e),i=rr(n);return r&&(i=i.toKeyedSeq()),i=i.flatten(),i.length=n.reduce(function(t,e){if(void 0!==t){var r=rr(e).length;if(null!=r)return t+r}},0),i}function J(t,e){var r=t.__makeSequence();return r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){var a=!1;return rr(t).__iterate(function(t,n){return r(t,e?n:u++,i)===!1?(a=!0,!1):void 0},n),!a},n),u},r}function B(t){return function(){return!t.apply(this,arguments)}}function L(t){return"string"==typeof t?JSON.stringify(t):t
<del>}function V(t,e){return t>e?1:e>t?-1:0}function N(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function T(t){s(1/0!==t,"Cannot perform this action with an infinite sequence.")}function F(t,e,r){return r instanceof rr?G(t,e,r):r}function G(t,e,r){return new vr(t._rootData,t._keyPath.concat(e),t._onChange,r)}function H(t,e,r){var n=t._rootData.updateIn(t._keyPath,r?gr.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new vr(n,t._keyPath,t._onChange)}function Q(t,e){return t instanceof vr&&(t=t.deref()),e instanceof vr&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof rr?t.equals(e):!1}function X(t,e){return l(t,e[0],e[1])}function Y(t,e){return{node:t,index:0,__prev:e}}function Z(t,e,r,n){var i=Object.create(mr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function $(t,e,r){var i=n(We),u=n(Ke),a=te(t._root,t.__ownerID,0,o(e),e,r,i,u);if(!u.value)return t;var s=t.length+(i.value?r===Pe?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Z(s,a):gr.empty()}function te(t,e,r,n,u,a,s,o){return t?t.update(e,r,n,u,a,s,o):a===Pe?t:(i(o),i(s),new Ir(e,n,[u,a]))}function ee(t){return t.constructor===Ir||t.constructor===qr}function re(t,e,r,n,i){if(t.hash===n)return new qr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Ue,s=(0===r?n:n>>>r)&Ue,o=a===s?[re(t,e,r+je,n,i)]:(u=new Ir(e,n,i),s>a?[t,u]:[u,t]);return new yr(e,1<<a|1<<s,o)}function ne(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new yr(t,i,a)}function ie(t,e,r,n,i){for(var u=0,a=Array(Re),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new wr(t,u+1,a)}function ue(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof rr||(u=rr(u),u instanceof ur&&(u=u.fromEntrySeq())),u&&n.push(u)}return se(t,e,n)}function ae(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function se(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Pe);
<del>t.set(n,i===Pe?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function oe(t,e,r,n,i){var u=e.length;if(i===u)return n(t);s(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:gr.empty(),o=e[i],h=t.get(o,a),c=oe(h,e,r,n,i+1);return c===h?t:t.set(o,c)}function he(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ce(t,e,r,n){var i=n?t:a(t);return i[e]=r,i}function fe(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function _e(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function le(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>Re&&(h=Re),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-je;for(a=0;Ue>=a;a++){var _=u?Ue-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!le(v,f,l,n,i,u))return!1}}}return!0}function ve(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function ge(t,e,r,n,i,u,a){var s=Object.create(Er);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function pe(t,e,r){if(e=N(t,e),e>=t.length||0>e)return r===Pe?t:t.withMutations(function(t){0>e?we(t,e).set(0,r):we(t,0,e+1).set(e,r)});e+=t._origin;var i=t._tail,u=t._root,a=n(Ke);return e>=qe(t._size)?i=me(i,t.__ownerID,0,e,r,a):u=me(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ge(t._origin,t._size,t._level,u,i):t}function me(t,e,r,n,u,a){var s,o=u===Pe,h=n>>>r&Ue,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=me(f,e,r-je,n,u,a);return _===f?t:(s=ye(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===u?t:(i(a),s=ye(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:u,s)}function ye(t,e){return e&&t&&e===t.ownerID?t:new jr(t?t.array.slice():[],e)}function de(t,e){if(e>=qe(t._size))return t._tail;
<del>if(1<<t._level+je>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Ue],n-=je;return r}}function we(t,e,r){var n=t.__ownerID||new u,i=t._origin,a=t._size,s=i+e,o=null==r?a:0>r?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new jr(c&&c.array.length?[null,c]:[],n),h+=je,f+=1<<h;f&&(s+=f,i+=f,o+=f,a+=f);for(var _=qe(a),l=qe(o);l>=1<<h+je;)c=new jr(c&&c.array.length?[c]:[],n),h+=je;var v=t._tail,g=_>l?de(t,o-1):l>_?new jr([],n):v;if(v&&l>_&&a>s&&v.array.length){c=ye(c,n);for(var p=c,m=h;m>je;m-=je){var y=_>>>m&Ue;p=p.array[y]=ye(p.array[y],n)}p.array[_>>>je&Ue]=v}if(a>o&&(g=g&&g.removeAfter(n,0,o)),s>=l)s-=l,o-=l,h=je,c=null,g=g&&g.removeBefore(n,0,s);else if(s>i||_>l){var d,w;f=0;do d=s>>>h&Ue,w=l-1>>>h&Ue,d===w&&(d&&(f+=(1<<h)*d),h-=je,c=c&&c.array[d]);while(c&&d===w);c&&s>i&&(c=c&&c.removeBefore(n,h,s-f)),c&&_>l&&(c=c&&c.removeAfter(n,h,l-f)),f&&(s-=f,o-=f)}return t.__ownerID?(t.length=o-s,t._origin=s,t._size=o,t._level=h,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ge(s,o,h,c,g)}function Se(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(rr(u))}var a=Math.max.apply(null,n.map(function(t){return t.length||0}));return a>t.length&&(t=t.setLength(a)),se(t,e,n)}function qe(t){return Re>t?0:t-1>>>je<<je}function be(t,e){var r=Object.create(zr);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function Ie(t,e,r,n){var i=Object.create(Br.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=r,i.__hash=n,i}function Me(t,e,r){var n=t._map,i=t._vector,u=n.get(e),a=void 0!==u,s=r===Pe;if(!a&&s||a&&r===i.get(u)[1])return t;a||(u=i.length);var o=s?n.remove(e):a?n:n.set(e,u),h=s?i.remove(u):i.set(u,[e,r]);return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):Ie(o,h)}function ke(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function De(t,e){return e?xe(e,t,"",{"":t}):Oe(t)}function xe(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,rr(e).map(function(r,n){return xe(t,r,n,e)
<del>})):e}function Oe(t){if(t){if(Array.isArray(t))return rr(t).map(Oe).toVector();if(t.constructor===Object)return rr(t).map(Oe).toMap()}return t}var Ce=Object,Ae={};Ae.createClass=t,Ae.superCall=e,Ae.defaultSuperCall=r;var Ee="delete",je=5,Re=1<<je,Ue=Re-1,Pe={},We={value:!1},Ke={value:!1},ze=Object.prototype.propertyIsEnumerable,Je=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Be=2147483647,Le=0,Ve="__immutablehash__";"undefined"!=typeof Symbol&&(Ve=Symbol(Ve));var Ne=16,Te=255,Fe=0,Ge={},He=0,Qe=1,Xe=2,Ye="@@iterator",Ze="undefined"!=typeof Symbol?Symbol.iterator:Ye,$e=function(t){this.next=t};Ae.createClass($e,{toString:function(){return"[Iterator]"}},{});var tr=$e.prototype;tr.inspect=tr.toSource=function(){return""+this},tr[Ze]=function(){return this};var er={value:void 0,done:!1},rr=function(t){return nr.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},nr=rr;Ae.createClass(rr,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+L(t)},toJS:function(){return this.map(function(t){return t instanceof nr?t.toJS():t}).__toJS()},toArray:function(){T(this.length);var t=Array(this.length||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toObject:function(){T(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toVector:function(){return T(this.length),Cr.from(this)},toMap:function(){return T(this.length),gr.from(this)},toOrderedMap:function(){return T(this.length),Br.from(this)},toSet:function(){return T(this.length),Wr.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Be},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof nr))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0
<del>}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return i&&Q(n,i[0])&&Q(t,i[1])})&&r===e.length},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!=n?n:""}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.__iterate(O)),this.length)},countBy:function(t,e){var r=this,n={},i=[];return this.__iterate(function(u,a){var s=t.call(e,u,a,r),h=o(s);n.hasOwnProperty(h)?i[n[h]][1]++:(n[h]=i.length,i.push([s,1]))}),nr(i).fromEntrySeq()},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return z(this,t,!0)},flatten:function(){return J(this,!0)},flatMap:function(t,e){return this.map(t,e).flatten()},reverse:function(){return R(this)},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){return new or(this)},entrySeq:function(){var t=this;if(t._cache)return nr(t._cache);var e=t.toKeyedSeq().map(x).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,a){i?(i=!1,n=e):n=t.call(r,n,e,u,a)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(B(t),e)},first:function(){return this.find(O)},last:function(){return this.findLast(O)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,Pe)!==Pe},get:function(t,e){return this.find(function(e,r){return Q(r,t)},null,e)},getIn:function(t,e){var r=this;if(t)for(var n=0;t.length>n;n++)if(r=r&&r.get?r.get(t[n],Pe):Pe,r===Pe)return e;return r},contains:function(t){return this.find(function(e){return Q(e,t)
<del>},null,Pe)!==Pe},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){return E(this)},map:function(t,e){return j(this,t,e)},mapKeys:function(t,e){var r=this;return this.flip().map(function(n,i){return t.call(e,n,i,r)}).flip()},mapEntries:function(t,e){var r=this;return this.entrySeq().map(function(n,i){return t.call(e,n,i,r)}).fromEntrySeq()},filter:function(t,e){return U(this,t,e,!0)},slice:function(t,e){if(b(t,e,this.length))return this;var r=I(t,this.length),n=M(e,this.length);if(r!==r||n!==n)return this.cacheResult().slice(t,e);var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=this;if(t>e.length)return e;0>t&&(t=0);var r=e.__makeSequence();return r.__iterateUncached=function(r,n){var i=this;if(0===t)return 0;if(n)return this.cacheResult().__iterate(r,n);var u=0;return e.__iterate(function(e,n){return++u&&r(e,n,i)!==!1&&t>u}),u},r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0;return r.__iterate(function(r,i,s){return t.call(e,r,i,s)&&++a&&n(r,i,u)}),a},n},takeUntil:function(t,e){return this.takeWhile(B(t),e)},skip:function(t){return W(this,t,!0)},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){return K(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(B(t),e)},groupBy:function(t,e){return P(this,t,e,!0)},sort:function(t){return this.sortBy(D,t)},sortBy:function(t,e){e=e||V;var r=this;return nr(this.entrySeq().entrySeq().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]
<del>})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(T(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},keys:function(){return this.__iterator(He)},values:function(){return this.__iterator(Qe)},entries:function(){return this.__iterator(Xe)},__iterate:function(t,e){return C(this,t,e,!0)},__iterator:function(t,e){return A(this,t,e,!0)},__makeSequence:function(){return w()}},{from:function(t){if(t instanceof nr)return t;if(!Array.isArray(t)){if(m(t))return new cr(t);if(p(t))return new fr(t);if(t&&t.constructor===Object)return new _r(t);t=[t]}return new lr(t)}});var ir=rr.prototype;ir[Ze]=ir.entries,ir.toJSON=ir.toJS,ir.__toJS=ir.toObject,ir.inspect=ir.toSource=function(){return""+this},ir.chain=ir.flatMap;var ur=function(){Ae.defaultSuperCall(this,ar.prototype,arguments)},ar=ur;Ae.createClass(ur,{toString:function(){return this.__toString("Seq [","]")},toKeyedSeq:function(){return new hr(this)},valueSeq:function(){return this},fromEntrySeq:function(){var t=this,e=w();return e.length=t.length,e.entrySeq=function(){return t},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t){return t&&e(t[1],t[0],n)},r)},e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return z(this,t,!1)},filter:function(t,e){return U(this,t,e,!1)},get:function(t,e){return t=N(this,t),this.find(function(e,r){return r===t},null,e)},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},indexOf:function(t){return this.findIndex(function(e){return Q(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=I(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))
<del>},flip:function(){return E(this.toKeyedSeq())},flatten:function(){return J(this,!1)},skip:function(t){return W(this,t,!1)},skipWhile:function(t,e){return K(this,t,e,!1)},groupBy:function(t,e){return P(this,t,e,!1)},sortBy:function(t,e){e=e||V;var r=this;return rr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e){return C(this,t,e,!1)},__iterator:function(t,e){return A(this,t,e,!1)},__makeSequence:function(){return S(this)}},{},rr);var sr=ur.prototype;sr[Ze]=sr.values,sr.__toJS=sr.toArray,sr.__toStringMapper=L;var or=function(t){this._seq=t,this.length=t.length};Ae.createClass(or,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=0;return this._seq.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r,n=this._seq.__iterator(Qe,e),i=0;return new $e(function(){return(r=n.next()).done?v():l(t,i++,r.value)})}},{},ur);var hr=function(t){this._seq=t,this.length=t.length};Ae.createClass(hr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},valueSeq:function(){return this._seq},reverse:function(){var t=this,e=R(this);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=j(this,t,e);return n.valueSeq=function(){return r._seq.map(t,e)},n},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=e?q(this):0;return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(Qe,e),n=e?q(this):0;return new $e(function(){var i=r.next();return i.done?i:l(t,e?--n:n++,i.value)})}},{},rr);var cr=function(t){this._iterator=t,this._iteratorCache=[]};Ae.createClass(cr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;
<del>for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new $e(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},ur);var fr=function(t){this._iterable=t,this.length=t.length||t.size};Ae.createClass(fr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=y(r),i=0;if(m(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=y(r);if(!m(n))return new $e(function(){return v()});var i=0;return new $e(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},ur);var _r=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ae.createClass(_r,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var a=n[e?i-u:u];if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new $e(function(){var a=n[e?i-u:u];return u++>i?v():l(t,a,r[a])})}},{},rr);var lr=function(t){this._array=t,this.length=t.length};Ae.createClass(lr,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[N(this,t)]:e},has:function(t){return t=N(this,t),t>=0&&this.length>t},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new $e(function(){return i>n?v():l(t,i,r[e?n-i++:i++])})}},{},ur);var vr=function(t,e,r,n){n=n?n:t.getIn(e),this.length=n instanceof rr?n.length:null,this._rootData=t,this._keyPath=e,this._onChange=r
<add>}function w(){return Object.create(ir)}function S(){return Object.create(sr)}function q(t){return null==t.length&&t.cacheResult(),s(1/0>t.length,"Cannot reverse infinite range."),t.length}function b(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function I(t,e){return k(t,e,0)}function M(t,e){return k(t,e,e)}function k(t,e,r){return null==t?r:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function D(t){return t}function x(t,e){return[e,t]}function O(){return!0}function C(t){return function(){return!t.apply(this,arguments)}}function A(t){return"string"==typeof t?JSON.stringify(t):t}function E(t,e){return t>e?1:e>t?-1:0}function j(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function R(t){s(1/0!==t,"Cannot perform this action with an infinite sequence.")}function U(t,e,r,n){var i=t._cache;if(i){for(var u=i.length-1,a=0;u>=a;a++){var s=i[r?u-a:a];if(e(s[1],n?s[0]:a,t)===!1)return a+1}return a}return t.__iterateUncached(e,r)}function P(t,e,r,n){var i=t._cache;if(i){var u=i.length-1,a=0;return new $e(function(){var t=i[r?u-a:a];return a++>u?v():l(e,n?t[0]:a-1,t[1])})}return t.__iteratorUncached?t.__iteratorUncached(e,r):t.cacheResult().__iterator(e,r)}function W(t){var e=t.__makeSequence();return e.length=t.length,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.contains(e)},e.contains=function(e){return t.has(e)},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e}function K(t,e,r){var n=t.__makeSequence();return n.length=t.length,n.has=function(e){return t.has(e)},n.get=function(n,i){var u=t.get(n,Pe);return u===Pe?i:e.call(r,u,n,t)},n.__iterateUncached=function(n,i){var u=this;return t.__iterate(function(t,i,a){return n(e.call(r,t,i,a),i,u)!==!1},i)},n.__iteratorUncached=function(n,i){var u=t.__iterator(Xe,i);return new $e(function(){var i=u.next();if(i.done)return i;var a=i.value,s=a[0];return l(n,s,e.call(r,a[1],s,t))})},n}function z(t){var e=t.__makeSequence();
<add>return e.length=t.length,e.reverse=function(){return t},e.flip=function(){var e=t.flip.apply(this);return e.reverse=function(){return t.flip()},e},e.get=function(e,r){return t.get(e,r)},e.has=function(e){return t.has(e)},e.contains=function(e){return t.contains(e)},e.cacheResult=function(){return t.cacheResult(),this.length=t.length,this},e.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},e.__iterator=function(e,r){return t.__iterator(e,!r)},e}function J(t,e,r,n){var i=t.__makeSequence();return i.has=function(n){var i=t.get(n,Pe);return i!==Pe&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,Pe);return u!==Pe&&e.call(r,u,n,t)?u:i},i.__iterateUncached=function(i,u){var a=this,s=0;return t.__iterate(function(t,u,o){return e.call(r,t,u,o)?(s++,i(t,n?u:s-1,a)):void 0},u),s},i.__iteratorUncached=function(i,u){var a=t.__iterator(Xe,u),s=0;return new $e(function(){for(;;){var u=a.next();if(u.done)return u;var o=u.value,h=o[0],c=o[1];if(e.call(r,c,h,t))return l(i,n?h:s++,c)}})},i}function B(t,e,r,n){var i={},u=[];return t.__iterate(function(a,s){var h=e.call(r,a,s,t),c=o(h),f=n?[s,a]:a;i.hasOwnProperty(c)?u[i[c]][1].push(f):(i[c]=u.length,u.push([h,[f]]))}),rr(u).fromEntrySeq().map(n?function(t){return rr(t).fromEntrySeq()}:function(t){return rr(t)})}function L(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.length=t.length&&Math.max(0,t.length-e),n}function V(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i}function N(t,e,r){var n=[t].concat(e),i=rr(n);return r&&(i=i.toKeyedSeq()),i=i.flatten(),i.length=n.reduce(function(t,e){if(void 0!==t){var r=rr(e).length;if(null!=r)return t+r}},0),i
<add>}function T(t,e){var r=t.__makeSequence();return r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){var a=!1;return rr(t).__iterate(function(t,n){return r(t,e?n:u++,i)===!1?(a=!0,!1):void 0},n),!a},n),u},r}function F(t,e,r){return r instanceof rr?G(t,e,r):r}function G(t,e,r){return new vr(t._rootData,t._keyPath.concat(e),t._onChange,r)}function H(t,e,r){var n=t._rootData.updateIn(t._keyPath,r?gr.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new vr(n,t._keyPath,t._onChange)}function Q(t,e){return t instanceof vr&&(t=t.deref()),e instanceof vr&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof rr?t.equals(e):!1}function X(t,e){return l(t,e[0],e[1])}function Y(t,e){return{node:t,index:0,__prev:e}}function Z(t,e,r,n){var i=Object.create(mr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function $(t,e,r){var i=n(We),u=n(Ke),a=te(t._root,t.__ownerID,0,o(e),e,r,i,u);if(!u.value)return t;var s=t.length+(i.value?r===Pe?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Z(s,a):gr.empty()}function te(t,e,r,n,u,a,s,o){return t?t.update(e,r,n,u,a,s,o):a===Pe?t:(i(o),i(s),new Ir(e,n,[u,a]))}function ee(t){return t.constructor===Ir||t.constructor===qr}function re(t,e,r,n,i){if(t.hash===n)return new qr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Ue,s=(0===r?n:n>>>r)&Ue,o=a===s?[re(t,e,r+je,n,i)]:(u=new Ir(e,n,i),s>a?[t,u]:[u,t]);return new yr(e,1<<a|1<<s,o)}function ne(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new yr(t,i,a)}function ie(t,e,r,n,i){for(var u=0,a=Array(Re),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new wr(t,u+1,a)}function ue(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof rr||(u=rr(u),u instanceof ur&&(u=u.fromEntrySeq())),u&&n.push(u)}return se(t,e,n)}function ae(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r
<add>}}function se(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Pe);t.set(n,i===Pe?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function oe(t,e,r,n,i){var u=e.length;if(i===u)return n(t);s(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:gr.empty(),o=e[i],h=t.get(o,a),c=oe(h,e,r,n,i+1);return c===h?t:t.set(o,c)}function he(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ce(t,e,r,n){var i=n?t:a(t);return i[e]=r,i}function fe(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function _e(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function le(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>Re&&(h=Re),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-je;for(a=0;Ue>=a;a++){var _=u?Ue-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!le(v,f,l,n,i,u))return!1}}}return!0}function ve(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function ge(t,e,r,n,i,u,a){var s=Object.create(Er);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function pe(t,e,r){if(e=j(t,e),e>=t.length||0>e)return r===Pe?t:t.withMutations(function(t){0>e?we(t,e).set(0,r):we(t,0,e+1).set(e,r)});e+=t._origin;var i=t._tail,u=t._root,a=n(Ke);return e>=qe(t._size)?i=me(i,t.__ownerID,0,e,r,a):u=me(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ge(t._origin,t._size,t._level,u,i):t}function me(t,e,r,n,u,a){var s,o=u===Pe,h=n>>>r&Ue,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=me(f,e,r-je,n,u,a);return _===f?t:(s=ye(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===u?t:(i(a),s=ye(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:u,s)
<add>}function ye(t,e){return e&&t&&e===t.ownerID?t:new jr(t?t.array.slice():[],e)}function de(t,e){if(e>=qe(t._size))return t._tail;if(1<<t._level+je>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Ue],n-=je;return r}}function we(t,e,r){var n=t.__ownerID||new u,i=t._origin,a=t._size,s=i+e,o=null==r?a:0>r?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new jr(c&&c.array.length?[null,c]:[],n),h+=je,f+=1<<h;f&&(s+=f,i+=f,o+=f,a+=f);for(var _=qe(a),l=qe(o);l>=1<<h+je;)c=new jr(c&&c.array.length?[c]:[],n),h+=je;var v=t._tail,g=_>l?de(t,o-1):l>_?new jr([],n):v;if(v&&l>_&&a>s&&v.array.length){c=ye(c,n);for(var p=c,m=h;m>je;m-=je){var y=_>>>m&Ue;p=p.array[y]=ye(p.array[y],n)}p.array[_>>>je&Ue]=v}if(a>o&&(g=g&&g.removeAfter(n,0,o)),s>=l)s-=l,o-=l,h=je,c=null,g=g&&g.removeBefore(n,0,s);else if(s>i||_>l){var d,w;f=0;do d=s>>>h&Ue,w=l-1>>>h&Ue,d===w&&(d&&(f+=(1<<h)*d),h-=je,c=c&&c.array[d]);while(c&&d===w);c&&s>i&&(c=c&&c.removeBefore(n,h,s-f)),c&&_>l&&(c=c&&c.removeAfter(n,h,l-f)),f&&(s-=f,o-=f)}return t.__ownerID?(t.length=o-s,t._origin=s,t._size=o,t._level=h,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ge(s,o,h,c,g)}function Se(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(rr(u))}var a=Math.max.apply(null,n.map(function(t){return t.length||0}));return a>t.length&&(t=t.setLength(a)),se(t,e,n)}function qe(t){return Re>t?0:t-1>>>je<<je}function be(t,e){var r=Object.create(zr);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function Ie(t,e,r,n){var i=Object.create(Br.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=r,i.__hash=n,i}function Me(t,e,r){var n=t._map,i=t._vector,u=n.get(e),a=void 0!==u,s=r===Pe;if(!a&&s||a&&r===i.get(u)[1])return t;a||(u=i.length);var o=s?n.remove(e):a?n:n.set(e,u),h=s?i.remove(u):i.set(u,[e,r]);return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):Ie(o,h)}function ke(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function De(t,e){return e?xe(e,t,"",{"":t}):Oe(t)
<add>}function xe(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,rr(e).map(function(r,n){return xe(t,r,n,e)})):e}function Oe(t){if(t){if(Array.isArray(t))return rr(t).map(Oe).toVector();if(t.constructor===Object)return rr(t).map(Oe).toMap()}return t}var Ce=Object,Ae={};Ae.createClass=t,Ae.superCall=e,Ae.defaultSuperCall=r;var Ee="delete",je=5,Re=1<<je,Ue=Re-1,Pe={},We={value:!1},Ke={value:!1},ze=Object.prototype.propertyIsEnumerable,Je=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Be=2147483647,Le=0,Ve="__immutablehash__";"undefined"!=typeof Symbol&&(Ve=Symbol(Ve));var Ne=16,Te=255,Fe=0,Ge={},He=0,Qe=1,Xe=2,Ye="@@iterator",Ze="undefined"!=typeof Symbol?Symbol.iterator:Ye,$e=function(t){this.next=t};Ae.createClass($e,{toString:function(){return"[Iterator]"}},{});var tr=$e.prototype;tr.inspect=tr.toSource=function(){return""+this},tr[Ze]=function(){return this};var er={value:void 0,done:!1},rr=function(t){return nr.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},nr=rr;Ae.createClass(rr,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+A(t)},toJS:function(){return this.map(function(t){return t instanceof nr?t.toJS():t}).__toJS()},toArray:function(){R(this.length);var t=Array(this.length||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toObject:function(){R(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toVector:function(){return R(this.length),Cr.from(this)},toMap:function(){return R(this.length),gr.from(this)},toOrderedMap:function(){return R(this.length),Br.from(this)},toSet:function(){return R(this.length),Wr.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Be},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof nr))return!1;
<add>if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return i&&Q(n,i[0])&&Q(t,i[1])})&&r===e.length},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!=n?n:""}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.__iterate(O)),this.length)},countBy:function(t,e){var r=this,n={},i=[];return this.__iterate(function(u,a){var s=t.call(e,u,a,r),h=o(s);n.hasOwnProperty(h)?i[n[h]][1]++:(n[h]=i.length,i.push([s,1]))}),nr(i).fromEntrySeq()},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!0)},flatten:function(){return T(this,!0)},flatMap:function(t,e){return this.map(t,e).flatten()},reverse:function(){return z(this)},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){return new _r(this)},entrySeq:function(){var t=this;if(t._cache)return nr(t._cache);var e=t.toKeyedSeq().map(x).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,a){i?(i=!1,n=e):n=t.call(r,n,e,u,a)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(C(t),e)},first:function(){return this.find(O)},last:function(){return this.findLast(O)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,Pe)!==Pe},get:function(t,e){return this.find(function(e,r){return Q(r,t)},null,e)},getIn:function(t,e){var r=this;if(t)for(var n=0;t.length>n;n++)if(r=r&&r.get?r.get(t[n],Pe):Pe,r===Pe)return e;
<add>return r},contains:function(t){return this.find(function(e){return Q(e,t)},null,Pe)!==Pe},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){return W(this)},map:function(t,e){return K(this,t,e)},mapKeys:function(t,e){var r=this;return this.flip().map(function(n,i){return t.call(e,n,i,r)}).flip()},mapEntries:function(t,e){var r=this;return this.entrySeq().map(function(n,i){return t.call(e,n,i,r)}).fromEntrySeq()},filter:function(t,e){return J(this,t,e,!0)},slice:function(t,e){if(b(t,e,this.length))return this;var r=I(t,this.length),n=M(e,this.length);if(r!==r||n!==n)return this.cacheResult().slice(t,e);var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=this;if(t>e.length)return e;0>t&&(t=0);var r=e.__makeSequence();return r.__iterateUncached=function(r,n){var i=this;if(0===t)return 0;if(n)return this.cacheResult().__iterate(r,n);var u=0;return e.__iterate(function(e,n){return++u&&r(e,n,i)!==!1&&t>u}),u},r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0;return r.__iterate(function(r,i,s){return t.call(e,r,i,s)&&++a&&n(r,i,u)}),a},n},takeUntil:function(t,e){return this.takeWhile(C(t),e)},skip:function(t){return L(this,t,!0)},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){return V(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(C(t),e)},groupBy:function(t,e){return B(this,t,e,!0)},sort:function(t){return this.sortBy(D,t)},sortBy:function(t,e){e=e||E;var r=this;return nr(this.entrySeq().entrySeq().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]
<add>})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(R(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},keys:function(){return this.__iterator(He)},values:function(){return this.__iterator(Qe)},entries:function(){return this.__iterator(Xe)},__iterate:function(t,e){return U(this,t,e,!0)},__iterator:function(t,e){return P(this,t,e,!0)},__makeSequence:function(){return w()}},{from:function(t){if(t instanceof nr)return t;if(!Array.isArray(t)){if(m(t))return new or(t);if(p(t))return new hr(t);if(t&&t.constructor===Object)return new cr(t);t=[t]}return new fr(t)}});var ir=rr.prototype;ir[Ze]=ir.entries,ir.toJSON=ir.toJS,ir.__toJS=ir.toObject,ir.inspect=ir.toSource=function(){return""+this},ir.chain=ir.flatMap;var ur=function(){Ae.defaultSuperCall(this,ar.prototype,arguments)},ar=ur;Ae.createClass(ur,{toString:function(){return this.__toString("Seq [","]")},toKeyedSeq:function(){return new lr(this)},valueSeq:function(){return this},fromEntrySeq:function(){var t=this,e=w();return e.length=t.length,e.entrySeq=function(){return t},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t){return t&&e(t[1],t[0],n)},r)},e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!1)},filter:function(t,e){return J(this,t,e,!1)},get:function(t,e){return t=j(this,t),this.find(function(e,r){return r===t},null,e)},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},indexOf:function(t){return this.findIndex(function(e){return Q(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=I(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))
<add>},flip:function(){return W(this.toKeyedSeq())},flatten:function(){return T(this,!1)},skip:function(t){return L(this,t,!1)},skipWhile:function(t,e){return V(this,t,e,!1)},groupBy:function(t,e){return B(this,t,e,!1)},sortBy:function(t,e){e=e||E;var r=this;return rr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e){return U(this,t,e,!1)},__iterator:function(t,e){return P(this,t,e,!1)},__makeSequence:function(){return S(this)}},{},rr);var sr=ur.prototype;sr[Ze]=sr.values,sr.__toJS=sr.toArray,sr.__toStringMapper=A;var or=function(t){this._iterator=t,this._iteratorCache=[]};Ae.createClass(or,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new $e(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},ur);var hr=function(t){this._iterable=t,this.length=t.length||t.size};Ae.createClass(hr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=y(r),i=0;if(m(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=y(r);if(!m(n))return new $e(function(){return v()});var i=0;return new $e(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},ur);var cr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ae.createClass(cr,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var a=n[e?i-u:u];
<add>if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new $e(function(){var a=n[e?i-u:u];return u++>i?v():l(t,a,r[a])})}},{},rr);var fr=function(t){this._array=t,this.length=t.length};Ae.createClass(fr,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[j(this,t)]:e},has:function(t){return t=j(this,t),t>=0&&this.length>t},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new $e(function(){return i>n?v():l(t,i,r[e?n-i++:i++])})}},{},ur);var _r=function(t){this._seq=t,this.length=t.length};Ae.createClass(_r,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=0;return this._seq.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r,n=this._seq.__iterator(Qe,e),i=0;return new $e(function(){return(r=n.next()).done?v():l(t,i++,r.value)})}},{},ur);var lr=function(t){this._seq=t,this.length=t.length};Ae.createClass(lr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},valueSeq:function(){return this._seq},reverse:function(){var t=this,e=z(this);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=K(this,t,e);return n.valueSeq=function(){return r._seq.map(t,e)},n},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=e?q(this):0;return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(Qe,e),n=e?q(this):0;return new $e(function(){var i=r.next();return i.done?i:l(t,e?--n:n++,i.value)})}},{},rr);var vr=function(t,e,r,n){n=n?n:t.getIn(e),this.length=n instanceof rr?n.length:null,this._rootData=t,this._keyPath=e,this._onChange=r
<ide> };Ae.createClass(vr,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var r=this._rootData.getIn(this._keyPath.concat(t),Pe);return r===Pe?e:F(this,t,r)},set:function(t,e){return H(this,function(r){return r.set(t,e)},t)},remove:function(t){return H(this,function(e){return e.remove(t)},t)},clear:function(){return H(this,function(t){return t.clear()})},update:function(t,e,r){return 1===arguments.length?H(this,t):H(this,function(n){return n.update(t,e,r)},t)},withMutations:function(t){return H(this,function(e){return(e||gr.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:G(this,t)},__iterate:function(t,e){var r=this,n=this,i=n.deref();return i&&i.__iterate?i.__iterate(function(e,i){return t(F(n,i,e),i,r)},e):0}},{},rr),vr.prototype[Ee]=vr.prototype.remove,vr.prototype.getIn=vr.prototype.get;var gr=function(t){var e=pr.empty();return t?t.constructor===pr?t:e.merge(t):e},pr=gr;Ae.createClass(gr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,o(t),t,e):e},set:function(t,e){return $(this,t,e)},remove:function(t){return $(this,t,Pe)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){var n;return r||(n=[e,r],r=n[0],e=n[1],n),oe(this,t,e,r,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):pr.empty()},merge:function(){return ue(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ue(this,t,e)},mergeDeep:function(){return ue(this,ae(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ue(this,ae(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new vr(this,t,e)},withMutations:function(t){var e=this.asMutable();
<ide> return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new kr(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__deepEquals:function(t){var e=this;return t.every(function(t,r){return Q(e.get(r,Pe),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?Z(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Dr||(Dr=Z(0))}},rr);var mr=gr.prototype;mr[Ee]=mr.remove,gr.from=gr;var yr=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},dr=yr;Ae.createClass(yr,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Ue),u=this.bitmap;return 0===(u&i)?n:this.nodes[he(u&i-1)].get(t+je,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Ue,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===Pe)return this;var f=he(h&o-1),_=this.nodes,l=c?_[f]:null,v=te(l,t,e+je,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=xr)return ie(t,_,h,s,v);if(c&&!v&&2===_.length&&ee(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&ee(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?ce(_,f,v,g):_e(_,f,g):fe(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new dr(t,p,m)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++)if(r[e?i-n:n].iterate(t,e)===!1)return!1}},{});var wr=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},Sr=wr;Ae.createClass(wr,{get:function(t,e,r,n){var i=(0===t?e:e>>>t)&Ue,u=this.nodes[i];return u?u.get(t+je,e,r,n):n},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Ue,o=i===Pe,h=this.nodes,c=h[s];if(o&&!c)return this;var f=te(c,t,e+je,r,n,i,u,a);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Or>_))return ne(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=ce(h,s,f,l);return l?(this.count=_,this.nodes=v,this):new Sr(t,_,v)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];
<del>if(u&&u.iterate(t,e)===!1)return!1}}},{});var qr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},br=qr;Ae.createClass(qr,{get:function(t,e,r,n){for(var i=this.entries,u=0,a=i.length;a>u;u++)if(Q(r,i[u][0]))return i[u][1];return n},update:function(t,e,r,n,u,s,o){var h=u===Pe;if(r!==this.hash)return h?this:(i(o),i(s),re(this,t,e,r,[n,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!Q(n,c[f][0]);f++);var l=_>f;if(h&&!l)return this;if(i(o),(h||!l)&&i(s),h&&2===_)return new Ir(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:a(c);return l?h?f===_-1?g.pop():g[f]=g.pop():g[f]=[n,u]:g.push([n,u]),v?(this.entries=g,this):new br(t,this.hash,g)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var Ir=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Mr=Ir;Ae.createClass(Ir,{get:function(t,e,r,n){return Q(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,u,a,s){var o=u===Pe,h=Q(n,this.entry[0]);return(h?u===this.entry[1]:o)?this:(i(s),o?(i(a),null):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Mr(t,r,[n,u]):(i(a),re(this,t,e,r,[n,u])))},iterate:function(t){return t(this.entry)}},{});var kr=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&Y(t._root)};Ae.createClass(kr,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return X(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return X(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return X(t,u.entry);e=this._stack=Y(u,e)}continue}e=this._stack=this._stack.__prev}return v()}},{},$e);var Dr,xr=Re/2,Or=Re/4,Cr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ar.from(t)},Ar=Cr;Ae.createClass(Cr,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=N(this,t),t>=0&&this.length>t},get:function(t,e){if(t=N(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=de(this,t);return r&&r.array[t&Ue]
<add>if(u&&u.iterate(t,e)===!1)return!1}}},{});var qr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},br=qr;Ae.createClass(qr,{get:function(t,e,r,n){for(var i=this.entries,u=0,a=i.length;a>u;u++)if(Q(r,i[u][0]))return i[u][1];return n},update:function(t,e,r,n,u,s,o){var h=u===Pe;if(r!==this.hash)return h?this:(i(o),i(s),re(this,t,e,r,[n,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!Q(n,c[f][0]);f++);var l=_>f;if(h&&!l)return this;if(i(o),(h||!l)&&i(s),h&&2===_)return new Ir(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:a(c);return l?h?f===_-1?g.pop():g[f]=g.pop():g[f]=[n,u]:g.push([n,u]),v?(this.entries=g,this):new br(t,this.hash,g)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var Ir=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Mr=Ir;Ae.createClass(Ir,{get:function(t,e,r,n){return Q(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,u,a,s){var o=u===Pe,h=Q(n,this.entry[0]);return(h?u===this.entry[1]:o)?this:(i(s),o?(i(a),null):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Mr(t,r,[n,u]):(i(a),re(this,t,e,r,[n,u])))},iterate:function(t){return t(this.entry)}},{});var kr=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&Y(t._root)};Ae.createClass(kr,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return X(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return X(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return X(t,u.entry);e=this._stack=Y(u,e)}continue}e=this._stack=this._stack.__prev}return v()}},{},$e);var Dr,xr=Re/2,Or=Re/4,Cr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ar.from(t)},Ar=Cr;Ae.createClass(Cr,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=j(this,t),t>=0&&this.length>t},get:function(t,e){if(t=j(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=de(this,t);return r&&r.array[t&Ue]
<ide> },set:function(t,e){return pe(this,t,e)},remove:function(t){return pe(this,t,Pe)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=je,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ar.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){we(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return we(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){we(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return we(this,1)},merge:function(){return Se(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return Se(this,t,e)},mergeDeep:function(){return Se(this,ae(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return Se(this,ae(t),e)},setLength:function(t){return we(this,0,t)},slice:function(t,e){var r=Ae.superCall(this,Ar.prototype,"slice",[t,e]);if(r!==this){var n=this,i=n.length;r.toVector=function(){return we(n,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return r},__iterator:function(t,e){return new Ur(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=qe(this._size);return e?le(this._tail,0,u-this._origin,this._size-this._origin,i,e)&&le(this._root,this._level,-this._origin,u-this._origin,i,e):le(this._root,this._level,-this._origin,u-this._origin,i,e)&&le(this._tail,0,u-this._origin,this._size-this._origin,i,e),n},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,r){var n=e.next().value;return n&&n[0]===r&&Q(n[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?ge(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return Pr||(Pr=ge(0,0,je))},from:function(t){if(!t||0===t.length)return Ar.empty();if(t.constructor===Ar)return t;
<ide> var e=Array.isArray(t);return t.length>0&&Re>t.length?ge(0,t.length,je,null,new jr(e?a(t):rr(t).toArray())):(e||(t=rr(t).valueSeq()),Ar.empty().merge(t))}},ur);var Er=Cr.prototype;Er[Ee]=Er.remove,Er.update=mr.update,Er.updateIn=mr.updateIn,Er.cursor=mr.cursor,Er.withMutations=mr.withMutations,Er.asMutable=mr.asMutable,Er.asImmutable=mr.asImmutable,Er.wasAltered=mr.wasAltered;var jr=function(t,e){this.array=t,this.ownerID=e},Rr=jr;Ae.createClass(jr,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&Ue;if(n>=this.array.length)return new Rr([],t);var i,u=0===n;if(e>0){var a=this.array[n];if(i=a&&a.removeBefore(t,e-je,r),i===a&&u)return this}if(u&&!i)return this;var s=ye(this,t);if(!u)for(var o=0;n>o;o++)s.array[o]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&Ue;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var a=this.array[n];if(i=a&&a.removeAfter(t,e-je,r),i===a&&u)return this}if(u&&!i)return this;var s=ye(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var Ur=function(t,e,r){this._type=e,this._reverse=!!r,this._maxIndex=t.length-1;var n=qe(t._size),i=ve(t._root&&t._root.array,t._level,-t._origin,n-t._origin-1),u=ve(t._tail&&t._tail.array,0,n-t._origin,t._size-t._origin-1);this._stack=r?u:i,this._stack.__prev=r?i:u};Ae.createClass(Ur,{next:function(){for(var t=this._stack;t;){var e=t.array,r=t.index++;if(this._reverse&&(r=Ue-r,r>t.rawMax&&(r=t.rawMax,t.index=Re-r)),r>=0&&Re>r&&t.rawMax>=r){var n=e&&e[r];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(r<<t.level),this._reverse&&(i=this._maxIndex-i)),l(u,i,n)}this._stack=t=ve(n&&n.array,t.level-je,t.offset+(r<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return v()}},{},$e);var Pr,Wr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Kr.from(t)},Kr=Wr;Ae.createClass(Wr,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)
<ide> },get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:be(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?Kr.empty():be(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Kr.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++)rr(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return rr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return rr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},isSubset:function(t){return t=rr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=rr(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},hashCode:function(){return this._map.hashCode()},__iterator:function(t,e){var r=this._map.__iterator(He,e);return t===Xe?g(r,function(t){return[t,t]}):r},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?be(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Jr||(Jr=be(gr.empty()))},from:function(t){var e=Kr.empty();return t?t.constructor===Kr?t:e.union(t):e},fromKeys:function(t){return Kr.from(rr(t).flip())}},rr);var zr=Wr.prototype;zr[Ee]=zr.remove,zr[Ze]=zr.values,zr.contains=zr.has,zr.mergeDeep=zr.merge=zr.union,zr.mergeDeepWith=zr.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];
<ide> return this.merge.apply(this,t)},zr.withMutations=mr.withMutations,zr.asMutable=mr.asMutable,zr.asImmutable=mr.asImmutable,zr.__toJS=sr.__toJS,zr.__toStringMapper=sr.__toStringMapper;var Jr,Br=function(t){var e=Lr.empty();return t?t.constructor===Lr?t:e.merge(t):e},Lr=Br;Ae.createClass(Br,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return null!=r?this._vector.get(r)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):Lr.empty()},set:function(t,e){return Me(this,t,e)},remove:function(t){return Me(this,t,Pe)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},__iterator:function(t,e){var r=this._vector.__iterator(Qe,e);return t===He?g(r,function(t){return t[0]}):t===Qe?g(r,function(t){return t[1]}):r},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,r){var n=e.next().value;return n&&Q(n[0],r)&&Q(n[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._vector.__ensureOwner(t);return t?Ie(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Vr||(Vr=Ie(gr.empty(),Cr.empty()))}},gr),Br.from=Br,Br.prototype[Ee]=Br.prototype.remove;var Vr,Nr=function(t,e){var r=function(t){return this instanceof r?void(this._map=gr(t)):new r(t)};t=rr(t);var n=r.prototype=Object.create(Fr);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){s(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},Tr=Nr;Ae.createClass(Nr,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e
<del>},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return Tr._empty||(Tr._empty=ke(this,gr.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:ke(this,r)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:ke(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?ke(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},rr);var Fr=Nr.prototype;Fr[Ee]=Fr.remove,Fr.merge=mr.merge,Fr.mergeWith=mr.mergeWith,Fr.mergeDeep=mr.mergeDeep,Fr.mergeDeepWith=mr.mergeDeepWith,Fr.update=mr.update,Fr.updateIn=mr.updateIn,Fr.cursor=mr.cursor,Fr.withMutations=mr.withMutations,Fr.asMutable=mr.asMutable,Fr.asImmutable=mr.asImmutable,Fr.__deepEquals=mr.__deepEquals;var Gr=function(t,e,r){return this instanceof Hr?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Xr?Xr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Hr(t,e,r)},Hr=Gr;Ae.createClass(Gr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=N(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=N(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return b(t,e,this.length)?this:(t=I(t,this.length),e=M(e,this.length),t>=e?Xr:new Hr(this.get(t,this._end),this.get(e,this._end),this._step))
<add>},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return Tr._empty||(Tr._empty=ke(this,gr.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:ke(this,r)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:ke(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?ke(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},rr);var Fr=Nr.prototype;Fr[Ee]=Fr.remove,Fr.merge=mr.merge,Fr.mergeWith=mr.mergeWith,Fr.mergeDeep=mr.mergeDeep,Fr.mergeDeepWith=mr.mergeDeepWith,Fr.update=mr.update,Fr.updateIn=mr.updateIn,Fr.cursor=mr.cursor,Fr.withMutations=mr.withMutations,Fr.asMutable=mr.asMutable,Fr.asImmutable=mr.asImmutable,Fr.__deepEquals=mr.__deepEquals;var Gr=function(t,e,r){return this instanceof Hr?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Xr?Xr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Hr(t,e,r)},Hr=Gr;Ae.createClass(Gr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=j(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=j(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return b(t,e,this.length)?this:(t=I(t,this.length),e=M(e,this.length),t>=e?Xr:new Hr(this.get(t,this._end),this.get(e,this._end),this._step))
<ide> },indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new $e(function(){var a=i;return i+=e?-n:n,u>r?v():l(t,u++,a)})},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},ur);var Qr=Gr.prototype;Qr.__toJS=Qr.toArray,Qr.first=Er.first,Qr.last=Er.last;var Xr=Gr(0,0),Yr=function(t,e){return 0===e&&tn?tn:this instanceof Zr?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Zr(t,e)},Zr=Yr;Ae.createClass(Yr,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return Q(this._value,t)},slice:function(t,e){var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new Zr(this._value,e-t):tn},reverse:function(){return this},indexOf:function(t){return Q(this._value,t)?0:-1},lastIndexOf:function(t){return Q(this._value,t)?this.length:-1},__iterate:function(t){for(var e=0;this.length>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new $e(function(){return e.length>r?l(t,r++,e._value):v()})},__deepEquals:function(t){return Q(this._value,t._value)}},{},ur);var $r=Yr.prototype;$r.last=$r.first,$r.has=Qr.has,$r.take=Qr.take,$r.skip=Qr.skip,$r.__toJS=Qr.__toJS;var tn=new Yr(void 0,0),en={Sequence:rr,Map:gr,Vector:Cr,Set:Wr,OrderedMap:Br,Record:Nr,Range:Gr,Repeat:Yr,is:Q,fromJS:De};return en}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide><path>src/Sequence.js
<ide> IndexedSequencePrototype.__toJS = IndexedSequencePrototype.toArray;
<ide> IndexedSequencePrototype.__toStringMapper = quoteString;
<ide>
<ide>
<del>class ValuesSequence extends IndexedSequence {
<del> constructor(seq) {
<del> this._seq = seq;
<del> this.length = seq.length;
<del> }
<del>
<del> get(key, notSetValue) {
<del> return this._seq.get(key, notSetValue);
<del> }
<del>
<del> has(key) {
<del> return this._seq.has(key);
<del> }
<del>
<del> cacheResult() {
<del> this._seq.cacheResult();
<del> this.length = this._seq.length;
<del> return this;
<del> }
<del>
<del> __iterate(fn, reverse) {
<del> var iterations = 0;
<del> return this._seq.__iterate(v => fn(v, iterations++, this), reverse);
<del> }
<del>
<del> __iterator(type, reverse) {
<del> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<del> var iterations = 0;
<del> var step;
<del> return new Iterator(() =>
<del> (step = iterator.next()).done ?
<del> iteratorDone() :
<del> iteratorValue(type, iterations++, step.value)
<del> );
<del> }
<del>}
<del>
<del>
<del>class KeyedIndexedSequence extends Sequence {
<del> constructor(indexedSeq) {
<del> this._seq = indexedSeq;
<del> this.length = indexedSeq.length;
<del> }
<del>
<del> get(key, notSetValue) {
<del> return this._seq.get(key, notSetValue);
<del> }
<del>
<del> has(key) {
<del> return this._seq.has(key);
<del> }
<del>
<del> valueSeq() {
<del> return this._seq;
<del> }
<del>
<del> reverse() {
<del> var reversedSequence = reverseFactory(this);
<del> reversedSequence.valueSeq = () => this._seq.reverse();
<del> return reversedSequence;
<del> }
<del>
<del> map(mapper, context) {
<del> var mappedSequence = mapFactory(this, mapper, context);
<del> mappedSequence.valueSeq = () => this._seq.map(mapper, context);
<del> return mappedSequence;
<del> }
<del>
<del> cacheResult() {
<del> this._seq.cacheResult();
<del> this.length = this._seq.length;
<del> return this;
<del> }
<del>
<del> __iterate(fn, reverse) {
<del> var ii = reverse ? ensureLength(this) : 0;
<del> return this._seq.__iterate(
<del> v => fn(v, reverse ? --ii : ii++, this),
<del> reverse
<del> );
<del> }
<del>
<del> __iterator(type, reverse) {
<del> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<del> var ii = reverse ? ensureLength(this) : 0;
<del> return new Iterator(() => {
<del> var step = iterator.next();
<del> return step.done ? step :
<del> iteratorValue(type, reverse ? --ii : ii++, step.value)
<del> });
<del> }
<del>}
<ide>
<add>// #pragma Root Sequences
<ide>
<ide> class IteratorSequence extends IndexedSequence {
<ide> constructor(iterator) {
<ide> class ArraySequence extends IndexedSequence {
<ide> }
<ide>
<ide>
<add>
<add>// #pragma Helper functions
<add>
<ide> function makeSequence() {
<ide> return Object.create(SequencePrototype);
<ide> }
<ide> function returnTrue() {
<ide> return true;
<ide> }
<ide>
<add>function not(predicate) {
<add> return function() {
<add> return !predicate.apply(this, arguments);
<add> }
<add>}
<add>
<add>function quoteString(value) {
<add> return typeof value === 'string' ? JSON.stringify(value) : value;
<add>}
<add>
<add>function defaultComparator(a, b) {
<add> return a > b ? 1 : a < b ? -1 : 0;
<add>}
<add>
<add>function wrapIndex(seq, index) {
<add> if (index < 0) {
<add> if (seq.length == null) {
<add> seq.cacheResult();
<add> }
<add> return seq.length + index;
<add> }
<add> return index;
<add>}
<add>
<add>function assertNotInfinite(length) {
<add> invariant(
<add> length !== Infinity,
<add> 'Cannot perform this action with an infinite sequence.'
<add> );
<add>}
<add>
<add>
<add>// #pragma Iteration Base Implementations
<add>
<ide> function iterate(sequence, fn, reverse, useKeys) {
<ide> var cache = sequence._cache;
<ide> if (cache) {
<ide> function iterator(sequence, type, reverse, useKeys) {
<ide> return sequence.__iteratorUncached(type, reverse);
<ide> }
<ide>
<add>
<add>
<add>// #pragma Lazy Sequence Factories
<add>
<add>class ValuesSequence extends IndexedSequence {
<add> constructor(seq) {
<add> this._seq = seq;
<add> this.length = seq.length;
<add> }
<add>
<add> get(key, notSetValue) {
<add> return this._seq.get(key, notSetValue);
<add> }
<add>
<add> has(key) {
<add> return this._seq.has(key);
<add> }
<add>
<add> cacheResult() {
<add> this._seq.cacheResult();
<add> this.length = this._seq.length;
<add> return this;
<add> }
<add>
<add> __iterate(fn, reverse) {
<add> var iterations = 0;
<add> return this._seq.__iterate(v => fn(v, iterations++, this), reverse);
<add> }
<add>
<add> __iterator(type, reverse) {
<add> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<add> var iterations = 0;
<add> var step;
<add> return new Iterator(() =>
<add> (step = iterator.next()).done ?
<add> iteratorDone() :
<add> iteratorValue(type, iterations++, step.value)
<add> );
<add> }
<add>}
<add>
<add>
<add>class KeyedIndexedSequence extends Sequence {
<add> constructor(indexedSeq) {
<add> this._seq = indexedSeq;
<add> this.length = indexedSeq.length;
<add> }
<add>
<add> get(key, notSetValue) {
<add> return this._seq.get(key, notSetValue);
<add> }
<add>
<add> has(key) {
<add> return this._seq.has(key);
<add> }
<add>
<add> valueSeq() {
<add> return this._seq;
<add> }
<add>
<add> reverse() {
<add> var reversedSequence = reverseFactory(this);
<add> reversedSequence.valueSeq = () => this._seq.reverse();
<add> return reversedSequence;
<add> }
<add>
<add> map(mapper, context) {
<add> var mappedSequence = mapFactory(this, mapper, context);
<add> mappedSequence.valueSeq = () => this._seq.map(mapper, context);
<add> return mappedSequence;
<add> }
<add>
<add> cacheResult() {
<add> this._seq.cacheResult();
<add> this.length = this._seq.length;
<add> return this;
<add> }
<add>
<add> __iterate(fn, reverse) {
<add> var ii = reverse ? ensureLength(this) : 0;
<add> return this._seq.__iterate(
<add> v => fn(v, reverse ? --ii : ii++, this),
<add> reverse
<add> );
<add> }
<add>
<add> __iterator(type, reverse) {
<add> var iterator = this._seq.__iterator(ITERATE_VALUES, reverse);
<add> var ii = reverse ? ensureLength(this) : 0;
<add> return new Iterator(() => {
<add> var step = iterator.next();
<add> return step.done ? step :
<add> iteratorValue(type, reverse ? --ii : ii++, step.value)
<add> });
<add> }
<add>}
<add>
<add>
<ide> function flipFactory(sequence) {
<ide> var flipSequence = sequence.__makeSequence();
<ide> flipSequence.length = sequence.length;
<ide> function flattenFactory(sequence, useKeys) {
<ide> }
<ide> return flatSequence;
<ide> }
<del>
<del>function not(predicate) {
<del> return function() {
<del> return !predicate.apply(this, arguments);
<del> }
<del>}
<del>
<del>function quoteString(value) {
<del> return typeof value === 'string' ? JSON.stringify(value) : value;
<del>}
<del>
<del>function defaultComparator(a, b) {
<del> return a > b ? 1 : a < b ? -1 : 0;
<del>}
<del>
<del>function wrapIndex(seq, index) {
<del> if (index < 0) {
<del> if (seq.length == null) {
<del> seq.cacheResult();
<del> }
<del> return seq.length + index;
<del> }
<del> return index;
<del>}
<del>
<del>function assertNotInfinite(length) {
<del> invariant(
<del> length !== Infinity,
<del> 'Cannot perform this action with an infinite sequence.'
<del> );
<del>} | 3 |
Python | Python | set version to 2.0.4 | 05f41ff5872ca770d0dac49f0d5144a42fffd369 | <ide><path>spacy/about.py
<ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
<ide>
<ide> __title__ = 'spacy'
<del>__version__ = '2.0.4.dev0'
<add>__version__ = '2.0.4'
<ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython'
<ide> __uri__ = 'https://spacy.io'
<ide> __author__ = 'Explosion AI'
<ide> __email__ = 'contact@explosion.ai'
<ide> __license__ = 'MIT'
<del>__release__ = False
<add>__release__ = True
<ide>
<ide> __docs_models__ = 'https://spacy.io/usage/models'
<ide> __download_url__ = 'https://github.com/explosion/spacy-models/releases/download' | 1 |
PHP | PHP | add example of inflect option | 60aca56a6055f5ac7f65ed6f7fa0e882b233eecd | <ide><path>src/Routing/RouteBuilder.php
<ide> public function namePrefix($value = null)
<ide> * By default the path segment will match the key name. You can use the 'path' key inside the resource
<ide> * definition to customize the path name.
<ide> *
<add> * You can use the `inflect` option to change how path segments are generated:
<add> *
<add> * ```
<add> * $routes->resources('PaymentTypes', ['inflect' => 'dasherize']);
<add> * ```
<add> *
<add> * Will generate routes like `/payment-types` instead of `/payment_types`
<add> *
<ide> * ### Options:
<ide> *
<ide> * - 'id' - The regular expression fragment to use when matching IDs. By default, matches | 1 |
Python | Python | handle iob with no tag in converter | 5cf47b847ba50dc04253d77b65cf63a9b7347890 | <ide><path>spacy/cli/converters/iob2json.py
<ide> def iob2json(input_path, output_path, n_sents=10, *a, **k):
<ide> """
<ide> # TODO: This isn't complete yet -- need to map from IOB to
<ide> # BILUO
<del> with input_path.open() as file_:
<add> with input_path.open('r', encoding='utf8') as file_:
<ide> docs = read_iob(file_)
<ide>
<ide> output_filename = input_path.parts[-1].replace(".iob", ".json")
<ide> def read_iob(file_):
<ide> for line in file_:
<ide> if not line.strip():
<ide> continue
<del> tokens = [t.rsplit('|', 2) for t in line.split()]
<del> words, pos, iob = zip(*tokens)
<add> tokens = [t.split('|') for t in line.split()]
<add> if len(tokens[0]) == 3:
<add> words, pos, iob = zip(*tokens)
<add> else:
<add> words, iob = zip(*tokens)
<add> pos = ['-'] * len(words)
<ide> biluo = iob_to_biluo(iob)
<ide> sentences.append([
<ide> {'orth': w, 'tag': p, 'ner': ent} | 1 |
Text | Text | fix broken npm package.json link | a0a3c93b1d3eed70c1add22a527fce382ea72bcd | <ide><path>docs/creating-a-package.md
<ide> all the other available commands.
<ide> [status-bar]: https://github.com/atom/status-bar
<ide> [cs-syntax]: https://github.com/atom/language-coffee-script
<ide> [npm]: http://en.wikipedia.org/wiki/Npm_(software)
<del>[npm-keys]: https://npmjs.org/doc/json.html
<add>[npm-keys]: https://docs.npmjs.com/files/package.json
<ide> [git-tag]: http://git-scm.com/book/en/Git-Basics-Tagging
<ide> [wrap-guide]: https://github.com/atom/wrap-guide/
<ide> [keymaps]: advanced/keymaps.md | 1 |
Javascript | Javascript | fix the sourcemap url on minified bundles | 57a76c0c014eacb9c138ab8faf9aaabd964e416d | <ide><path>packager/react-packager/src/Bundler/Bundle.js
<ide> class Bundle {
<ide> const minifyActivity = Activity.startEvent('minify');
<ide> this._minifiedSourceAndMap = UglifyJS.minify(source, {
<ide> fromString: true,
<del> outSourceMap: 'bundle.js',
<add> outSourceMap: this._sourceMapUrl,
<ide> inSourceMap: this.getSourceMap(),
<ide> output: {ascii_only: true},
<ide> }); | 1 |
Go | Go | replace burntsushi/toml with pelletier/go-toml | a7ecbd4b2971605ab03bbacb122741a371b30919 | <ide><path>libnetwork/cmd/dnet/dnet.go
<ide> import (
<ide> "syscall"
<ide> "time"
<ide>
<del> "github.com/BurntSushi/toml"
<ide> "github.com/docker/docker/api/types/network"
<ide> "github.com/docker/docker/libnetwork"
<ide> "github.com/docker/docker/libnetwork/api"
<ide> import (
<ide> "github.com/docker/docker/pkg/reexec"
<ide> "github.com/gorilla/mux"
<ide> "github.com/moby/term"
<add> "github.com/pelletier/go-toml"
<ide> "github.com/sirupsen/logrus"
<ide> "github.com/urfave/cli"
<ide> )
<ide> func main() {
<ide> func (d *dnetConnection) parseOrchestrationConfig(tomlCfgFile string) error {
<ide> dummy := &dnetConnection{}
<ide>
<del> if _, err := toml.DecodeFile(tomlCfgFile, dummy); err != nil {
<add> data, err := ioutil.ReadFile(tomlCfgFile)
<add> if err != nil {
<add> return err
<add> }
<add> if err := toml.Unmarshal(data, dummy); err != nil {
<ide> return err
<ide> }
<ide>
<ide><path>libnetwork/config/config.go
<ide> package config
<ide>
<ide> import (
<ide> "fmt"
<add> "io/ioutil"
<ide> "strings"
<ide>
<del> "github.com/BurntSushi/toml"
<ide> "github.com/docker/docker/libnetwork/cluster"
<ide> "github.com/docker/docker/libnetwork/datastore"
<ide> "github.com/docker/docker/libnetwork/ipamutils"
<ide> import (
<ide> "github.com/docker/docker/pkg/plugingetter"
<ide> "github.com/docker/go-connections/tlsconfig"
<ide> "github.com/docker/libkv/store"
<add> "github.com/pelletier/go-toml"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<ide> func ParseConfig(tomlCfgFile string) (*Config, error) {
<ide> cfg := &Config{
<ide> Scopes: map[string]*datastore.ScopeCfg{},
<ide> }
<del>
<del> if _, err := toml.DecodeFile(tomlCfgFile, cfg); err != nil {
<add> data, err := ioutil.ReadFile(tomlCfgFile)
<add> if err != nil {
<add> return nil, err
<add> }
<add> if err := toml.Unmarshal(data, cfg); err != nil {
<ide> return nil, err
<ide> }
<ide> | 2 |
Java | Java | support animation events in vieweventmodule | c80309e5ae66d651c4dabcd5c0b4ec912797c9fd | <ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java
<ide> public String getName() {
<ide> * @return {@link NativeAnimatedNodesManager}
<ide> */
<ide> @Nullable
<del> private NativeAnimatedNodesManager getNodesManager() {
<add> public NativeAnimatedNodesManager getNodesManager() {
<ide> if (mNodesManager.get() == null) {
<ide> ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn();
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java
<ide> *
<ide> * <p>IMPORTANT: This class should be accessed only from the UI Thread
<ide> */
<del>/*package*/ class NativeAnimatedNodesManager implements EventDispatcherListener {
<add>public class NativeAnimatedNodesManager implements EventDispatcherListener {
<ide>
<ide> private static final String TAG = "NativeAnimatedNodesManager";
<ide> | 2 |
Python | Python | fix math in bartlett docstring | 89f1a4e66ffaefe0ce7fe969df55821d7b853ba9 | <ide><path>numpy/lib/function_base.py
<ide> def bartlett(M):
<ide> -----
<ide> The Bartlett window is defined as
<ide>
<del> .. math:: w(n) = \frac{2}{M-1} (\frac{M-1}{2} - |n - \frac{M-1}{2}|)
<add> .. math:: w(n) = \\frac{2}{M-1} (\\frac{M-1}{2} - |n - \\frac{M-1}{2}|)
<ide>
<ide> Most references to the Bartlett window come from the signal
<ide> processing literature, where it is used as one of many windowing | 1 |
Javascript | Javascript | fix urlobject parameter name in url.format | 8520e6f2804fad64fb50b91c80553715d3c83bd4 | <ide><path>lib/url.js
<ide> function autoEscapeStr(rest) {
<ide> }
<ide>
<ide> // format a parsed object into a url string
<del>function urlFormat(obj, options) {
<add>function urlFormat(urlObject, options) {
<ide> // ensure it's an object, and not a string url.
<del> // If it's an obj, this is a no-op.
<del> // this way, you can call url_format() on strings
<add> // If it's an object, this is a no-op.
<add> // this way, you can call urlParse() on strings
<ide> // to clean up potentially wonky urls.
<del> if (typeof obj === 'string') {
<del> obj = urlParse(obj);
<del> } else if (typeof obj !== 'object' || obj === null) {
<del> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'urlObj', 'object', obj);
<del> } else if (!(obj instanceof Url)) {
<del> var format = obj[formatSymbol];
<add> if (typeof urlObject === 'string') {
<add> urlObject = urlParse(urlObject);
<add> } else if (typeof urlObject !== 'object' || urlObject === null) {
<add> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'urlObject',
<add> ['object', 'string'], urlObject);
<add> } else if (!(urlObject instanceof Url)) {
<add> var format = urlObject[formatSymbol];
<ide> return format ?
<del> format.call(obj, options) :
<del> Url.prototype.format.call(obj);
<add> format.call(urlObject, options) :
<add> Url.prototype.format.call(urlObject);
<ide> }
<del> return obj.format();
<add> return urlObject.format();
<ide> }
<ide>
<ide> Url.prototype.format = function format() {
<ide><path>test/parallel/test-url-format-invalid-input.js
<ide> const throwsObjsAndReportTypes = new Map([
<ide> [Symbol('foo'), 'symbol']
<ide> ]);
<ide>
<del>for (const [obj, type] of throwsObjsAndReportTypes) {
<add>for (const [urlObject, type] of throwsObjsAndReportTypes) {
<ide> const error = common.expectsError({
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<del> message: 'The "urlObj" argument must be of type object. ' +
<add> message: 'The "urlObject" argument must be one of type object or string. ' +
<ide> `Received type ${type}`
<ide> });
<del> assert.throws(function() { url.format(obj); }, error);
<add> assert.throws(function() { url.format(urlObject); }, error);
<ide> }
<ide> assert.strictEqual(url.format(''), '');
<ide> assert.strictEqual(url.format({}), ''); | 2 |
Python | Python | write some tests for busday_offset | 29a3cebde0cb0c18e4120701e12e244a261a710f | <ide><path>numpy/core/tests/test_datetime.py
<ide> def test_timedelta_arange(self):
<ide> assert_raises(TypeError, np.arange, np.timedelta64(0,'Y'),
<ide> np.timedelta64(5,'D'))
<ide>
<del> def test_maximum_reduce(self):
<add> def test_datetime_maximum_reduce(self):
<ide> a = np.array(['2010-01-02','1999-03-14','1833-03'], dtype='M8[D]')
<ide> assert_equal(np.maximum.reduce(a).dtype, np.dtype('M8[D]'))
<ide> assert_equal(np.maximum.reduce(a),
<ide> def test_maximum_reduce(self):
<ide> assert_equal(np.maximum.reduce(a),
<ide> np.timedelta64(7, 's'))
<ide>
<add> def test_datetime_busday_offset(self):
<add> # First Monday in June
<add> assert_equal(
<add> np.busday_offset('2011-06',0,roll='forward',weekmask='Mon'),
<add> np.datetime64('2011-06-06'))
<add> # Last Monday in June
<add> assert_equal(
<add> np.busday_offset('2011-07',-1,roll='forward',weekmask='Mon'),
<add> np.datetime64('2011-06-27'))
<add> assert_equal(
<add> np.busday_offset('2011-07',-1,roll='forward',weekmask='Mon'),
<add> np.datetime64('2011-06-27'))
<add>
<add> # Default M-F business days, different roll modes
<add> assert_equal(np.busday_offset('2010-08', 0, roll='backward'),
<add> np.datetime64('2010-07-30'))
<add> assert_equal(np.busday_offset('2010-08', 0, roll='preceding'),
<add> np.datetime64('2010-07-30'))
<add> assert_equal(np.busday_offset('2010-08', 0, roll='modifiedpreceding'),
<add> np.datetime64('2010-08-02'))
<add> assert_equal(np.busday_offset('2010-08', 0, roll='modifiedfollowing'),
<add> np.datetime64('2010-08-02'))
<add> assert_equal(np.busday_offset('2010-08', 0, roll='forward'),
<add> np.datetime64('2010-08-02'))
<add> assert_equal(np.busday_offset('2010-08', 0, roll='following'),
<add> np.datetime64('2010-08-02'))
<add> assert_equal(np.busday_offset('2010-10-30', 0, roll='following'),
<add> np.datetime64('2010-11-01'))
<add> assert_equal(
<add> np.busday_offset('2010-10-30', 0, roll='modifiedfollowing'),
<add> np.datetime64('2010-10-29'))
<add> assert_equal(
<add> np.busday_offset('2010-10-30', 0, roll='modifiedpreceding'),
<add> np.datetime64('2010-10-29'))
<add> # roll='raise' by default
<add> assert_raises(ValueError, np.busday_offset, '2011-06-04', 0)
<add>
<add> # Bigger offset values
<add> assert_equal(np.busday_offset('2006-02-01', 25),
<add> np.datetime64('2006-03-08'))
<add> assert_equal(np.busday_offset('2006-03-08', -25),
<add> np.datetime64('2006-02-01'))
<add> assert_equal(np.busday_offset('2007-02-25', 11, weekmask='SatSun'),
<add> np.datetime64('2007-04-07'))
<add> assert_equal(np.busday_offset('2007-04-07', -11, weekmask='SatSun'),
<add> np.datetime64('2007-02-25'))
<add>
<ide> class TestDateTimeData(TestCase):
<ide>
<ide> def test_basic(self): | 1 |
Javascript | Javascript | fix normalization of css filename | 04ddb71e06b0d898eb70f3b42a9e11e0799f5cd2 | <ide><path>lib/config/normalization.js
<ide> const getNormalizedWebpackOptions = config => {
<ide> chunkLoading: output.chunkLoading,
<ide> chunkLoadingGlobal: output.chunkLoadingGlobal,
<ide> chunkLoadTimeout: output.chunkLoadTimeout,
<add> cssFilename: output.cssFilename,
<add> cssChunkFilename: output.cssChunkFilename,
<ide> clean: output.clean,
<ide> compareBeforeEmit: output.compareBeforeEmit,
<ide> crossOriginLoading: output.crossOriginLoading, | 1 |
Javascript | Javascript | hook the loading manager in stlloader.js | 4a1c953d9cdc42be93ca5f7a4dd8cd74509213be | <ide><path>examples/js/loaders/STLLoader.js
<ide> * @author aleeper / http://adamleeper.com/
<ide> * @author mrdoob / http://mrdoob.com/
<ide> * @author gero3 / https://github.com/gero3
<add> * @author zinefer / https://github.com/zinefer
<ide> *
<ide> * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs.
<ide> *
<ide> */
<ide>
<ide>
<del>THREE.STLLoader = function () {};
<add>THREE.STLLoader = function (manager) {
<add> this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
<add>};
<ide>
<ide> THREE.STLLoader.prototype = {
<ide>
<ide> THREE.STLLoader.prototype.load = function ( url, callback ) {
<ide>
<ide> }
<ide>
<del> xhr.addEventListener( 'load', onloaded, false );
<add> xhr.addEventListener( 'load', function(event){
<add> onloaded(event);
<add> scope.manager.itemEnd( url );
<add> }, false );
<ide>
<ide> xhr.addEventListener( 'progress', function ( event ) {
<ide>
<ide> THREE.STLLoader.prototype.load = function ( url, callback ) {
<ide> xhr.responseType = 'arraybuffer';
<ide> xhr.send( null );
<ide>
<add> scope.manager.itemStart( url );
<add>
<ide> };
<ide>
<ide> THREE.STLLoader.prototype.parse = function ( data ) { | 1 |
PHP | PHP | refactor the ignored error logging | fc8b30159ec611cc9e04b8e4e47754dc817d2054 | <ide><path>laravel/laravel.php
<ide> * errors are ignored and errors in the developer configured whitelist
<ide> * are silently logged.
<ide> */
<del>set_error_handler(function($number, $error, $file, $line) use ($logger)
<add>set_error_handler(function($code, $error, $file, $line) use ($logger)
<ide> {
<del> if (error_reporting() === 0)
<del> {
<del> return;
<del> }
<del> $exception = new \ErrorException($error, $number, 0, $file, $line);
<del> if (in_array($number, Config::$items['error']['ignore']))
<add> if (error_reporting() === 0) return;
<add>
<add> $exception = new \ErrorException($error, $code, 0, $file, $line);
<add>
<add> if (in_array($code, Config::$items['error']['ignore']))
<ide> {
<del> $logger($exception);
<del> return;
<add> return $logger($exception);
<ide> }
<add>
<ide> throw $exception;
<ide> });
<ide> | 1 |
Ruby | Ruby | improve `javascript_include_tag` documentation | c945da583b8f802216300d037e5a70ebc5da834c | <ide><path>actionview/lib/action_view/helpers/asset_tag_helper.rb
<ide> module AssetTagHelper
<ide> # When the Asset Pipeline is enabled, you can pass the name of your manifest as
<ide> # source, and include other JavaScript or CoffeeScript files inside the manifest.
<ide> #
<add> # ==== Options
<add> #
<add> # When the last parameter is a hash you can add HTML attributes using that
<add> # parameter. That options supports the following keys as well:
<add> #
<add> # * <tt>:extname</tt> - Append a extention to the generated url unless the extension
<add> # already exists. This only applies for relative urls.
<add> # * <tt>:protocol</tt> - Sets the protocol of the generated url, this option only
<add> # applies when a relative url and +host+ options are provided.
<add> # * <tt>:host</tt> - When a relative url is provided the host is added to the
<add> # that path.
<add> # * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
<add> # when it is set to true.
<add> #
<add> # ==== Examples
<add> #
<ide> # javascript_include_tag "xmlhr"
<del> # # => <script src="/assets/xmlhr.js?1284139606"></script>
<add> # # => <script src="/assets/xmlhr.debug-1284139606.js"></script>
<add> #
<add> # javascript_include_tag "xmlhr", host: "localhost", protocol: "https"
<add> # # => <script src="https://localhost/assets/xmlhr.debug-1284139606.js"></script>
<ide> #
<ide> # javascript_include_tag "template.jst", extname: false
<del> # # => <script src="/assets/template.jst?1284139606"></script>
<add> # # => <script src="/assets/template.debug-1284139606.jst"></script>
<ide> #
<ide> # javascript_include_tag "xmlhr.js"
<del> # # => <script src="/assets/xmlhr.js?1284139606"></script>
<add> # # => <script src="/assets/xmlhr.debug-1284139606.js"></script>
<ide> #
<ide> # javascript_include_tag "common.javascript", "/elsewhere/cools"
<del> # # => <script src="/assets/common.javascript?1284139606"></script>
<del> # # <script src="/elsewhere/cools.js?1423139606"></script>
<add> # # => <script src="/assets/common.javascript.debug-1284139606.js"></script>
<add> # # <script src="/elsewhere/cools.debug-1284139606.js"></script>
<ide> #
<ide> # javascript_include_tag "http://www.example.com/xmlhr"
<ide> # # => <script src="http://www.example.com/xmlhr"></script> | 1 |
Text | Text | add note about code organization with amd | dbc4608ed10bd1347649e6f1514f459957cda003 | <ide><path>CONTRIBUTING.md
<ide> Alternatively, you can **load tests in AMD** to avoid the need for rebuilding al
<ide> Click "Load with AMD" after loading the test page.
<ide>
<ide>
<add>### Repo organization
<add>
<add>The jQuery source is organized with AMD modules and then concatenated and compiled at build time.
<add>
<add>jQuery also contains some special modules we call "var modules", which are placed in folders named "var". At build time, these small modules are compiled to simple var statements. This makes it easy for us to share variables across modules. Browse the "src" folder for examples.
<add>
<ide> ### Browser support
<ide>
<ide> Remember that jQuery supports multiple browsers and their versions; any contributed code must work in all of them. You can refer to the [browser support page](https://jquery.com/browser-support/) for the current list of supported browsers. | 1 |
Python | Python | fix pipeline tests for roberta-like tokenizers | 7e7f62bfa72ca03e9f16285dad182f7c57cd8cab | <ide><path>tests/pipelines/test_pipelines_common.py
<ide> AutoModelForSequenceClassification,
<ide> AutoTokenizer,
<ide> DistilBertForSequenceClassification,
<del> IBertConfig,
<del> RobertaConfig,
<ide> TextClassificationPipeline,
<ide> TFAutoModelForSequenceClassification,
<ide> pipeline,
<ide> logger = logging.getLogger(__name__)
<ide>
<ide>
<add>ROBERTA_EMBEDDING_ADJUSMENT_CONFIGS = [
<add> "CamembertConfig",
<add> "IBertConfig",
<add> "LongformerConfig",
<add> "MarkupLMConfig",
<add> "RobertaConfig",
<add> "XLMRobertaConfig",
<add>]
<add>
<add>
<ide> def get_checkpoint_from_architecture(architecture):
<ide> try:
<ide> module = importlib.import_module(architecture.__module__)
<ide> def test(self):
<ide> try:
<ide> tokenizer = get_tiny_tokenizer_from_checkpoint(checkpoint)
<ide> # XLNet actually defines it as -1.
<del> if isinstance(model.config, (RobertaConfig, IBertConfig)):
<add> if model.config.__class__.__name__ in ROBERTA_EMBEDDING_ADJUSMENT_CONFIGS:
<ide> tokenizer.model_max_length = model.config.max_position_embeddings - 2
<ide> elif (
<ide> hasattr(model.config, "max_position_embeddings") | 1 |
Ruby | Ruby | remove need for headers on 10.14 | 0cd84274053d88f70e1244a21ede906dfa3bfda1 | <ide><path>Library/Homebrew/extend/os/mac/diagnostic.rb
<ide> def fatal_development_tools_checks
<ide> check_xcode_minimum_version
<ide> check_clt_minimum_version
<ide> check_if_xcode_needs_clt_installed
<del> check_if_clt_needs_headers_installed
<ide> ].freeze
<ide> end
<ide>
<ide> def check_if_xcode_needs_clt_installed
<ide> EOS
<ide> end
<ide>
<del> def check_if_clt_needs_headers_installed
<del> return unless MacOS::CLT.separate_header_package?
<del> return if MacOS::CLT.headers_installed?
<del>
<del> <<~EOS
<del> The Command Line Tools header package must be installed on #{MacOS.version.pretty_name}.
<del> The installer is located at:
<del> #{MacOS::CLT::HEADER_PKG_PATH.sub(":macos_version", MacOS.version)}
<del> EOS
<del> end
<del>
<ide> def check_for_other_package_managers
<ide> ponk = MacOS.macports_or_fink
<ide> return if ponk.empty?
<ide><path>Library/Homebrew/test/os/mac/diagnostic_spec.rb
<ide> .to match("Xcode alone is not sufficient on El Capitan")
<ide> end
<ide>
<del> specify "#check_if_clt_needs_headers_installed" do
<del> allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.14"))
<del> allow(MacOS::CLT).to receive(:installed?).and_return(true)
<del> allow(MacOS::CLT).to receive(:headers_installed?).and_return(false)
<del>
<del> expect(subject.check_if_clt_needs_headers_installed)
<del> .to match("The Command Line Tools header package must be installed on Mojave.")
<del>
<del> allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.13"))
<del> expect(subject.check_if_clt_needs_headers_installed)
<del> .to be_nil
<del> end
<del>
<ide> specify "#check_homebrew_prefix" do
<ide> # the integration tests are run in a special prefix
<ide> expect(subject.check_homebrew_prefix) | 2 |
Javascript | Javascript | add parser prewalking to capture scope | 3afe67d6fbe3a33a77b9f5ee0b02172c43f23828 | <ide><path>lib/Parser.js
<ide> class Parser extends Tapable {
<ide> this.walkExpression(methodDefinition.value);
<ide> }
<ide>
<del> walkStatements(statements) {
<del> for(let indexA = 0, lenA = statements.length; indexA < lenA; indexA++) {
<del> const statementA = statements[indexA];
<del> if(this.isHoistedStatement(statementA))
<del> this.walkStatement(statementA);
<del> }
<del> for(let indexB = 0, lenB = statements.length; indexB < lenB; indexB++) {
<del> const statementB = statements[indexB];
<del> if(!this.isHoistedStatement(statementB))
<del> this.walkStatement(statementB);
<add> // Prewalking iterates the scope for variable declarations
<add> prewalkStatements(statements) {
<add> for(let index = 0, len = statements.length; index < len; index++) {
<add> const statement = statements[index];
<add> this.prewalkStatement(statement);
<ide> }
<ide> }
<ide>
<del> isHoistedStatement(statement) {
<del> switch(statement.type) {
<del> case "ImportDeclaration":
<del> case "ExportAllDeclaration":
<del> case "ExportNamedDeclaration":
<del> return true;
<add> // Walking iterates the statements and expressions and processes them
<add> walkStatements(statements) {
<add> for(let index = 0, len = statements.length; index < len; index++) {
<add> const statement = statements[index];
<add> this.walkStatement(statement);
<ide> }
<del> return false;
<add> }
<add>
<add> prewalkStatement(statement) {
<add> const handler = this["prewalk" + statement.type];
<add> if(handler)
<add> handler.call(this, statement);
<ide> }
<ide>
<ide> walkStatement(statement) {
<ide> if(this.applyPluginsBailResult1("statement", statement) !== undefined) return;
<del> if(this["walk" + statement.type])
<del> this["walk" + statement.type](statement);
<add> const handler = this["walk" + statement.type];
<add> if(handler)
<add> handler.call(this, statement);
<ide> }
<ide>
<ide> // Real Statements
<add> prewalkBlockStatement(statement) {
<add> this.prewalkStatements(statement.body);
<add> }
<add>
<ide> walkBlockStatement(statement) {
<ide> this.walkStatements(statement.body);
<ide> }
<ide> class Parser extends Tapable {
<ide> this.walkExpression(statement.expression);
<ide> }
<ide>
<add> prewalkIfStatement(statement) {
<add> this.prewalkStatement(statement.consequent);
<add> if(statement.alternate)
<add> this.prewalkStatement(statement.alternate);
<add> }
<add>
<ide> walkIfStatement(statement) {
<ide> const result = this.applyPluginsBailResult1("statement if", statement);
<ide> if(result === undefined) {
<ide> class Parser extends Tapable {
<ide> }
<ide> }
<ide>
<add> prewalkLabeledStatement(statement) {
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkLabeledStatement(statement) {
<ide> const result = this.applyPluginsBailResult1("label " + statement.label.name, statement);
<ide> if(result !== true)
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<add> prewalkWithStatement(statement) {
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkWithStatement(statement) {
<ide> this.walkExpression(statement.object);
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<add> prewalkSwitchStatement(statement) {
<add> this.prewalkSwitchCases(statement.cases);
<add> }
<add>
<ide> walkSwitchStatement(statement) {
<ide> this.walkExpression(statement.discriminant);
<ide> this.walkSwitchCases(statement.cases);
<ide> class Parser extends Tapable {
<ide> this.walkTerminatingStatement(statement);
<ide> }
<ide>
<add> prewalkTryStatement(statement) {
<add> this.prewalkStatement(statement.block);
<add> }
<add>
<ide> walkTryStatement(statement) {
<ide> if(this.scope.inTry) {
<ide> this.walkStatement(statement.block);
<ide> class Parser extends Tapable {
<ide> this.walkStatement(statement.finalizer);
<ide> }
<ide>
<add> prewalkWhileStatement(statement) {
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkWhileStatement(statement) {
<ide> this.walkExpression(statement.test);
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<add> prewalkDoWhileStatement(statement) {
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkDoWhileStatement(statement) {
<ide> this.walkStatement(statement.body);
<ide> this.walkExpression(statement.test);
<ide> }
<ide>
<add> prewalkForStatement(statement) {
<add> if(statement.init) {
<add> if(statement.init.type === "VariableDeclaration")
<add> this.prewalkStatement(statement.init);
<add> }
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkForStatement(statement) {
<ide> if(statement.init) {
<ide> if(statement.init.type === "VariableDeclaration")
<ide> class Parser extends Tapable {
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<add> prewalkForInStatement(statement) {
<add> if(statement.left.type === "VariableDeclaration")
<add> this.prewalkStatement(statement.left);
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkForInStatement(statement) {
<ide> if(statement.left.type === "VariableDeclaration")
<ide> this.walkStatement(statement.left);
<ide> class Parser extends Tapable {
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<add> prewalkForOfStatement(statement) {
<add> if(statement.left.type === "VariableDeclaration")
<add> this.prewalkStatement(statement.left);
<add> this.prewalkStatement(statement.body);
<add> }
<add>
<ide> walkForOfStatement(statement) {
<ide> if(statement.left.type === "VariableDeclaration")
<ide> this.walkStatement(statement.left);
<ide> class Parser extends Tapable {
<ide> }
<ide>
<ide> // Declarations
<del> walkFunctionDeclaration(statement) {
<add> prewalkFunctionDeclaration(statement) {
<ide> if(statement.id) {
<ide> this.scope.renames["$" + statement.id.name] = undefined;
<ide> this.scope.definitions.push(statement.id.name);
<ide> }
<add> }
<add>
<add> walkFunctionDeclaration(statement) {
<ide> this.inScope(statement.params, function() {
<ide> if(statement.body.type === "BlockStatement")
<ide> this.walkStatement(statement.body);
<ide> class Parser extends Tapable {
<ide> }.bind(this));
<ide> }
<ide>
<del> walkImportDeclaration(statement) {
<add> prewalkImportDeclaration(statement) {
<ide> const source = statement.source.value;
<ide> this.applyPluginsBailResult("import", statement, source);
<ide> statement.specifiers.forEach(function(specifier) {
<ide> class Parser extends Tapable {
<ide> }, this);
<ide> }
<ide>
<del> walkExportNamedDeclaration(statement) {
<add> prewalkExportNamedDeclaration(statement) {
<ide> let source;
<ide> if(statement.source) {
<ide> source = statement.source.value;
<ide> class Parser extends Tapable {
<ide> } else {
<ide> if(!this.applyPluginsBailResult("export declaration", statement, statement.declaration)) {
<ide> const pos = this.scope.definitions.length;
<del> this.walkStatement(statement.declaration);
<add> this.prewalkStatement(statement.declaration);
<ide> const newDefs = this.scope.definitions.slice(pos);
<ide> for(let index = newDefs.length - 1; index >= 0; index--) {
<ide> const def = newDefs[index];
<ide> class Parser extends Tapable {
<ide> }
<ide> }
<ide>
<add> walkExportNamedDeclaration(statement) {
<add> if(statement.declaration) {
<add> this.walkStatement(statement.declaration);
<add> }
<add> }
<add>
<add> prewalkExportDefaultDeclaration(statement) {
<add> if(/Declaration$/.test(statement.declaration.type)) {
<add> const pos = this.scope.definitions.length;
<add> this.prewalkStatement(statement.declaration);
<add> const newDefs = this.scope.definitions.slice(pos);
<add> for(let index = 0, len = newDefs.length; index < len; index++) {
<add> const def = newDefs[index];
<add> this.applyPluginsBailResult("export specifier", statement, def, "default");
<add> }
<add> }
<add> }
<add>
<ide> walkExportDefaultDeclaration(statement) {
<ide> this.applyPluginsBailResult1("export", statement);
<ide> if(/Declaration$/.test(statement.declaration.type)) {
<ide> if(!this.applyPluginsBailResult("export declaration", statement, statement.declaration)) {
<del> const pos = this.scope.definitions.length;
<ide> this.walkStatement(statement.declaration);
<del> const newDefs = this.scope.definitions.slice(pos);
<del> for(let index = 0, len = newDefs.length; index < len; index++) {
<del> const def = newDefs[index];
<del> this.applyPluginsBailResult("export specifier", statement, def, "default");
<del> }
<ide> }
<ide> } else {
<ide> this.walkExpression(statement.declaration);
<ide> class Parser extends Tapable {
<ide> }
<ide> }
<ide>
<del> walkExportAllDeclaration(statement) {
<add> prewalkExportAllDeclaration(statement) {
<ide> const source = statement.source.value;
<ide> this.applyPluginsBailResult("export import", statement, source);
<ide> this.applyPluginsBailResult("export import specifier", statement, source, null, null, 0);
<ide> }
<ide>
<add> prewalkVariableDeclaration(statement) {
<add> if(statement.declarations)
<add> this.prewalkVariableDeclarators(statement.declarations);
<add> }
<add>
<ide> walkVariableDeclaration(statement) {
<ide> if(statement.declarations)
<ide> this.walkVariableDeclarators(statement.declarations);
<ide> }
<ide>
<del> walkClassDeclaration(statement) {
<add> prewalkClassDeclaration(statement) {
<ide> if(statement.id) {
<ide> this.scope.renames["$" + statement.id.name] = undefined;
<ide> this.scope.definitions.push(statement.id.name);
<ide> }
<add> }
<add>
<add> walkClassDeclaration(statement) {
<ide> this.walkClass(statement);
<ide> }
<ide>
<add> prewalkSwitchCases(switchCases) {
<add> for(let index = 0, len = switchCases.length; index < len; index++) {
<add> const switchCase = switchCases[index];
<add> this.prewalkStatements(switchCase.consequent);
<add> }
<add> }
<add>
<ide> walkSwitchCases(switchCases) {
<ide> for(let index = 0, len = switchCases.length; index < len; index++) {
<ide> const switchCase = switchCases[index];
<ide> class Parser extends Tapable {
<ide> if(catchClause.guard)
<ide> this.walkExpression(catchClause.guard);
<ide> this.inScope([catchClause.param], function() {
<add> this.prewalkStatement(catchClause.body);
<ide> this.walkStatement(catchClause.body);
<ide> }.bind(this));
<ide> }
<ide>
<del> walkVariableDeclarators(declarators) {
<add> prewalkVariableDeclarators(declarators) {
<ide> declarators.forEach(declarator => {
<ide> switch(declarator.type) {
<ide> case "VariableDeclarator":
<ide> class Parser extends Tapable {
<ide> if(idx >= 0) this.scope.definitions.splice(idx, 1);
<ide> }
<ide> } else {
<del> this.walkPattern(declarator.id);
<ide> this.enterPattern(declarator.id, (name, decl) => {
<ide> if(!this.applyPluginsBailResult1("var-" + declarator.kind + " " + name, decl)) {
<ide> if(!this.applyPluginsBailResult1("var " + name, decl)) {
<ide> class Parser extends Tapable {
<ide> }
<ide> }
<ide> });
<add> }
<add> break;
<add> }
<add> }
<add> });
<add> }
<add>
<add> walkVariableDeclarators(declarators) {
<add> declarators.forEach(declarator => {
<add> switch(declarator.type) {
<add> case "VariableDeclarator":
<add> {
<add> const renameIdentifier = declarator.init && this.getRenameIdentifier(declarator.init);
<add> if(!renameIdentifier || declarator.id.type !== "Identifier" || !this.applyPluginsBailResult1("can-rename " + renameIdentifier, declarator.init)) {
<add> this.walkPattern(declarator.id);
<ide> if(declarator.init)
<ide> this.walkExpression(declarator.init);
<ide> }
<ide> class Parser extends Tapable {
<ide>
<ide> walkFunctionExpression(expression) {
<ide> this.inScope(expression.params, function() {
<del> if(expression.body.type === "BlockStatement")
<add> if(expression.body.type === "BlockStatement") {
<add> this.prewalkStatement(expression.body);
<ide> this.walkStatement(expression.body);
<del> else
<add> } else {
<ide> this.walkExpression(expression.body);
<add> }
<ide> }.bind(this));
<ide> }
<ide>
<ide> walkArrowFunctionExpression(expression) {
<ide> this.inScope(expression.params, function() {
<del> if(expression.body.type === "BlockStatement")
<add> if(expression.body.type === "BlockStatement") {
<add> this.prewalkStatement(expression.body);
<ide> this.walkStatement(expression.body);
<del> else
<add> } else {
<ide> this.walkExpression(expression.body);
<add> }
<ide> }.bind(this));
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide> if(!params[i] || params[i].type !== "Identifier") continue;
<ide> this.scope.renames["$" + params[i].name] = param;
<ide> }
<del> if(functionExpression.body.type === "BlockStatement")
<add> if(functionExpression.body.type === "BlockStatement") {
<add> this.prewalkStatement(functionExpression.body);
<ide> this.walkStatement(functionExpression.body);
<del> else
<add> } else
<ide> this.walkExpression(functionExpression.body);
<ide> }.bind(this));
<ide> }
<ide> class Parser extends Tapable {
<ide> };
<ide> const state = this.state = initialState || {};
<ide> this.comments = comments;
<del> if(this.applyPluginsBailResult("program", ast, comments) === undefined)
<add> if(this.applyPluginsBailResult("program", ast, comments) === undefined) {
<add> this.prewalkStatements(ast.body);
<ide> this.walkStatements(ast.body);
<add> }
<ide> this.scope = oldScope;
<ide> this.state = oldState;
<ide> this.comments = oldComments;
<ide><path>test/Parser.test.js
<ide> describe("Parser", () => {
<ide> }
<ide> }, {
<ide> fghsub: ["try", "notry", "notry"],
<del> fgh: ["", "test ttt", "test e"]
<add> fgh: ["test", "test ttt", "test e"]
<ide> }
<ide> ],
<ide> "renaming with const": [
<ide><path>test/cases/parsing/issue-4608/index.js
<add>it("should find var declaration later in code", function() {
<add> (typeof require).should.be.eql("undefined");
<add>
<add> var require;
<add>});
<add>
<add>it("should find var declaration in same statement", function() {
<add> var fn = (function() {
<add> require("fail");
<add> }), require;
<add>
<add> require = (function(x) {
<add> x.should.be.eql("fail");
<add> });
<add> fn();
<add>});
<add>
<add>it("should find a catch block declaration", function() {
<add> try {
<add> var f = (function(x) {
<add> x.should.be.eql("fail");
<add> });
<add> throw f;
<add> } catch(require) {
<add> require("fail");
<add> }
<add>});
<add>
<add>it("should find var declaration in control statements", function() {
<add> var f = (function(x) {
<add> x.should.be.eql("fail");
<add> });
<add>
<add> (function() {
<add> {
<add> var require = f;
<add> }
<add>
<add> require("fail");
<add> }());
<add>
<add> (function() {
<add> var i = 1;
<add> while(i--) {
<add> var require = f;
<add> }
<add>
<add> require("fail");
<add> }());
<add>
<add> (function() {
<add> do {
<add> var require = f;
<add> } while(false);
<add>
<add> require("fail");
<add> }());
<add>
<add> (function() {
<add> for(var i = 0; i < 1; i++) {
<add> var require = f;
<add> }
<add>
<add> require("fail");
<add> }());
<add>
<add> (function() {
<add> for(var i in {a:1}) {
<add> var require = f;
<add> }
<add>
<add> require("fail");
<add> }());
<add>});
<add>
<add>it("should find var declaration in control statements after usage", function() {
<add> var f = (function(x) {
<add> x.should.be.eql("fail");
<add> });
<add>
<add> (function() {
<add> var test = (function() { require("fail"); });
<add>
<add> {
<add> var require = f;
<add> }
<add>
<add> test();
<add> }());
<add>
<add> (function() {
<add> var test = (function() { require("fail"); });
<add>
<add> var i = 1;
<add> while(i--) {
<add> var require = f;
<add> }
<add>
<add> test();
<add> }());
<add>
<add> (function() {
<add> var test = (function() { require("fail"); });
<add>
<add> do {
<add> var require = f;
<add> } while(false);
<add>
<add> test();
<add> }());
<add>
<add> (function() {
<add> var test = (function() { require("fail"); });
<add>
<add> for(var i = 0; i < 1; i++) {
<add> var require = f;
<add> }
<add>
<add> test();
<add> }());
<add>
<add> (function() {
<add> var test = (function() { require("fail"); });
<add>
<add> for(var i in {a:1}) {
<add> var require = f;
<add> }
<add>
<add> test();
<add> }());
<add>}); | 3 |
PHP | PHP | add method to split plugin and class names up | 7818aa87ec590cebd13837d1d2d8a55190e774bb | <ide><path>src/Console/Command/Task/BakeTask.php
<ide> public function getPath() {
<ide> * @return void
<ide> */
<ide> public function main() {
<del> foreach ($this->args as $i => $arg) {
<del> if (strpos($arg, '.')) {
<del> list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
<del> break;
<del> }
<del> }
<ide> if (isset($this->params['plugin'])) {
<ide> $this->plugin = $this->params['plugin'];
<ide> }
<ide> public function main() {
<ide> }
<ide> }
<ide>
<add>/**
<add> * Handles splitting up the plugin prefix and classname.
<add> *
<add> * Sets the plugin parameter and plugin property.
<add> *
<add> * @param string $name The name to possibly split.
<add> * @return string The name without the plugin prefix.
<add> */
<add> protected function _getName($name) {
<add> if (strpos($name, '.')) {
<add> list($plugin, $name) = pluginSplit($name);
<add> $this->plugin = $this->params['plugin'] = $plugin;
<add> }
<add> return $name;
<add> }
<add>
<ide> /**
<ide> * Get the option parser for this task.
<ide> *
<ide><path>src/Console/Command/Task/ControllerTask.php
<ide> class ControllerTask extends BakeTask {
<ide> */
<ide> public function main($name = null) {
<ide> parent::main();
<add> $name = $this->_getName($name);
<ide>
<ide> if (empty($name)) {
<ide> $this->out(__d('cake_console', 'Possible controllers based on your current database:'));
<ide><path>src/Console/Command/Task/FixtureTask.php
<ide> public function getOptionParser() {
<ide> */
<ide> public function main($name = null) {
<ide> parent::main();
<add> $name = $this->_getName($name);
<ide>
<ide> if (empty($name)) {
<ide> $this->out(__d('cake_console', 'Choose a fixture to bake from the following:'));
<ide><path>src/Console/Command/Task/ModelTask.php
<ide> class ModelTask extends BakeTask {
<ide> */
<ide> public function main($name = null) {
<ide> parent::main();
<add> $name = $this->_getName($name);
<ide>
<ide> if (empty($name)) {
<ide> $this->out(__d('cake_console', 'Choose a model to bake from the following:'));
<ide><path>src/Console/Command/Task/SimpleBakeTask.php
<ide> public function main($name = null) {
<ide> if (empty($name)) {
<ide> return $this->error('You must provide a name to bake a ' . $this->name());
<ide> }
<add> $name = $this->_getName($name);
<ide> $name = Inflector::camelize($name);
<ide> $this->bake($name);
<ide> $this->bakeTest($name);
<ide><path>src/Console/Command/Task/ViewTask.php
<ide> public function main($name = null, $template = null, $action = null) {
<ide> }
<ide> return true;
<ide> }
<add> $name = $this->_getName($name);
<ide>
<ide> $controller = null;
<ide> if (!empty($this->params['controller'])) { | 6 |
Ruby | Ruby | remove state from the preloader | 6e5a2cb9519aab568ea0cfea2f42364de8ccf655 | <ide><path>activerecord/lib/active_record/associations/preloader.rb
<ide> class Preloader #:nodoc:
<ide> autoload :BelongsTo, 'active_record/associations/preloader/belongs_to'
<ide> end
<ide>
<del> attr_reader :records, :associations, :preload_scope, :model
<del>
<ide> # Eager loads the named associations for the given Active Record record(s).
<ide> #
<ide> # In this description, 'association name' shall refer to the name passed
<ide> class Preloader #:nodoc:
<ide> # [ :books, :author ]
<ide> # { author: :avatar }
<ide> # [ :books, { author: :avatar } ]
<del> def initialize(records, associations, preload_scope = nil)
<del> @records = Array.wrap(records).compact.uniq
<del> @associations = Array.wrap(associations)
<del> @preload_scope = preload_scope || NULL_RELATION
<del> @preloaders = nil
<del> end
<ide>
<ide> NULL_RELATION = Struct.new(:values).new({})
<ide>
<del> def run
<del> preloaders.each(&:run)
<del> end
<del>
<del> def preloaders
<del> return @preloaders if @preloaders
<add> def preload(records, associations, preload_scope = nil)
<add> records = Array.wrap(records).compact.uniq
<add> associations = Array.wrap(associations)
<add> preload_scope = preload_scope || NULL_RELATION
<ide>
<ide> if records.empty?
<del> @preloaders = []
<add> []
<ide> else
<del> @preloaders = associations.flat_map { |association|
<add> associations.flat_map { |association|
<ide> preloaders_on association, records, preload_scope
<del> }
<add> }.each(&:run)
<ide> end
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/associations/preloader/through_association.rb
<ide> def associated_records_by_owner
<ide>
<ide> return @associated_records_by_owner if @associated_records_by_owner
<ide>
<del> left_loader = Preloader.new(owners,
<del> through_reflection.name,
<del> through_scope)
<del> left_loader.run
<add> left_loader = Preloader.new
<add> left_loader.preload(owners,
<add> through_reflection.name,
<add> through_scope)
<ide>
<ide> should_reset = (through_scope != through_reflection.klass.unscoped) ||
<ide> (reflection.options[:source_type] && through_reflection.collection?)
<ide> def associated_records_by_owner
<ide>
<ide> middle_records = through_records.map { |(_,rec,_)| rec }.flatten
<ide>
<del> preloader = Preloader.new(middle_records,
<del> source_reflection.name,
<del> reflection_scope)
<add> preloader = Preloader.new
<add> preloaders = preloader.preload(middle_records,
<add> source_reflection.name,
<add> reflection_scope)
<ide>
<del> preloader.run
<del>
<del> middle_to_pl = preloader.preloaders.each_with_object({}) do |pl,h|
<add> middle_to_pl = preloaders.each_with_object({}) do |pl,h|
<ide> pl.owners.each { |middle|
<ide> h[middle] = pl
<ide> }
<ide><path>activerecord/lib/active_record/relation.rb
<ide> def exec_queries
<ide> preload = preload_values
<ide> preload += includes_values unless eager_loading?
<ide> preload.each do |associations|
<del> ActiveRecord::Associations::Preloader.new(@records, associations).run
<add> pl = ActiveRecord::Associations::Preloader.new
<add> pl.preload @records, associations
<ide> end
<ide>
<ide> @records.each { |record| record.readonly! } if readonly_value | 3 |
Text | Text | remove bad link to irc info | 8c290fd0f131924e1b54bb80cddbb9809c2937a8 | <ide><path>README.md
<ide> If you didn't find an answer in the resources above, try these unofficial
<ide> resources:
<ide>
<ide> * [Questions tagged 'node.js' on StackOverflow][]
<del>* [#node.js channel on chat.freenode.net][]. See <http://nodeirc.info/> for more
<del> information.
<add>* [#node.js channel on chat.freenode.net][]
<ide> * [Node.js Discord Community](https://discordapp.com/invite/v7rrPdE)
<ide> * [Node.js Slack Community](https://node-js.slack.com/): Visit
<ide> [nodeslackers.com](http://www.nodeslackers.com/) to register. | 1 |
Python | Python | add comment on recursive weights loading | 851ef592c57bfb0af3807548e798570242c45510 | <ide><path>transformers/modeling_utils.py
<ide> def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
<ide> if metadata is not None:
<ide> state_dict._metadata = metadata
<ide>
<add> # PyTorch's `_load_from_state_dict` does not copy parameters in a module's descendants
<add> # so we need to apply the function recursively.
<ide> def load(module, prefix=''):
<ide> local_metadata = {} if metadata is None else metadata.get(prefix[:-1], {})
<ide> module._load_from_state_dict( | 1 |
Python | Python | add a test case for it | 47d666f92f08eb3830a3b92a6f1c6e0732a1c5d4 | <ide><path>libcloud/test/compute/test_digitalocean_v2.py
<ide> def test_list_sizes_success(self):
<ide> self.assertEqual(size.name, '1gb')
<ide> self.assertEqual(size.ram, 1024)
<ide>
<add> def test_list_sizes_filter_by_location_success(self):
<add> location = self.driver.list_locations()[1]
<add> sizes = self.driver.list_sizes(location=location)
<add> self.assertTrue(len(sizes) >= 1)
<add>
<add> size = sizes[0]
<add> self.assertTrue(size.id is not None)
<add> self.assertEqual(size.name, '512mb')
<add> self.assertTrue(location.id in size.extra['regions'])
<add>
<ide> def test_list_locations_success(self):
<ide> locations = self.driver.list_locations()
<ide> self.assertTrue(len(locations) == 2) | 1 |
Ruby | Ruby | remove feature checking for class#descendants | bc07139db323770778307179ab9eddf5b877bac2 | <ide><path>activesupport/lib/active_support/core_ext/class/subclasses.rb
<ide> require "active_support/ruby_features"
<ide>
<ide> class Class
<del> unless ActiveSupport::RubyFeatures::CLASS_DESCENDANTS
<del> if ActiveSupport::RubyFeatures::CLASS_SUBCLASSES
<del> def descendants
<del> subclasses.concat(subclasses.flat_map(&:descendants))
<del> end
<del> else
<del> # Returns an array with all classes that are < than its receiver.
<del> #
<del> # class C; end
<del> # C.descendants # => []
<del> #
<del> # class B < C; end
<del> # C.descendants # => [B]
<del> #
<del> # class A < B; end
<del> # C.descendants # => [B, A]
<del> #
<del> # class D < C; end
<del> # C.descendants # => [B, A, D]
<del> def descendants
<del> ObjectSpace.each_object(singleton_class).reject do |k|
<del> k.singleton_class? || k == self
<del> end
<add> if ActiveSupport::RubyFeatures::CLASS_SUBCLASSES
<add> def descendants
<add> subclasses.concat(subclasses.flat_map(&:descendants))
<add> end
<add> else
<add> # Returns an array with all classes that are < than its receiver.
<add> #
<add> # class C; end
<add> # C.descendants # => []
<add> #
<add> # class B < C; end
<add> # C.descendants # => [B]
<add> #
<add> # class A < B; end
<add> # C.descendants # => [B, A]
<add> #
<add> # class D < C; end
<add> # C.descendants # => [B, A, D]
<add> def descendants
<add> ObjectSpace.each_object(singleton_class).reject do |k|
<add> k.singleton_class? || k == self
<ide> end
<ide> end
<ide> end
<ide><path>activesupport/lib/active_support/descendants_tracker.rb
<ide> def disable_clear! # :nodoc:
<ide> unless @clear_disabled
<ide> @clear_disabled = true
<ide> remove_method(:subclasses)
<del> remove_method(:descendants) if RubyFeatures::CLASS_DESCENDANTS
<ide> @@excluded_descendants = nil
<ide> end
<ide> end
<ide> def subclasses
<ide> subclasses
<ide> end
<ide>
<del> if RubyFeatures::CLASS_DESCENDANTS
<del> def descendants
<del> descendants = super
<del> descendants.reject! { |d| @@excluded_descendants[d] }
<del> descendants
<del> end
<del> else
<del> def descendants
<del> subclasses.concat(subclasses.flat_map(&:descendants))
<del> end
<add> def descendants
<add> subclasses.concat(subclasses.flat_map(&:descendants))
<ide> end
<ide>
<ide> def direct_descendants
<ide><path>activesupport/lib/active_support/ruby_features.rb
<ide> module ActiveSupport
<ide> module RubyFeatures # :nodoc:
<ide> CLASS_SUBCLASSES = Class.method_defined?(:subclasses) # RUBY_VERSION >= "3.1"
<del> CLASS_DESCENDANTS = Class.method_defined?(:descendants)
<ide> end
<ide> end | 3 |
Go | Go | use defined variable | 555ce0cb54943dab39f16582fc1923467e42af14 | <ide><path>daemon/container.go
<ide> func (container *Container) GetSize() (int64, int64) {
<ide> }
<ide> defer container.Unmount()
<ide>
<del> if differ, ok := container.daemon.driver.(graphdriver.Differ); ok {
<add> if differ, ok := driver.(graphdriver.Differ); ok {
<ide> sizeRw, err = differ.DiffSize(container.ID)
<ide> if err != nil {
<ide> log.Errorf("Warning: driver %s couldn't return diff size of container %s: %s", driver, container.ID, err) | 1 |
Java | Java | utilize default methods in testexecutionlistener | d6d4251550a82fc6642bd11c43664e8c0dba5294 | <ide><path>spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java
<ide> * test execution events published by the {@link TestContextManager} with which
<ide> * the listener is registered.
<ide> *
<add> * <p>This interface provides empty {@code default} implementations for all methods.
<add> * Concrete implementations can therefore choose to override only those methods
<add> * suitable for the task at hand.
<add> *
<ide> * <p>Concrete implementations must provide a {@code public} no-args constructor,
<ide> * so that listeners can be instantiated transparently by tools and configuration
<ide> * mechanisms.
<ide> * @author Sam Brannen
<ide> * @author Juergen Hoeller
<ide> * @since 2.5
<add> * @see org.springframework.test.context.support.AbstractTestExecutionListener
<ide> */
<ide> public interface TestExecutionListener {
<ide>
<ide> public interface TestExecutionListener {
<ide> * <em>before class</em> lifecycle callbacks.
<ide> * <p>If a given testing framework does not support <em>before class</em>
<ide> * lifecycle callbacks, this method will not be called for that framework.
<add> * <p>The default implementation is <em>empty</em>. Can be overridden by
<add> * concrete classes as necessary.
<ide> * @param testContext the test context for the test; never {@code null}
<ide> * @throws Exception allows any exception to propagate
<ide> */
<del> void beforeTestClass(TestContext testContext) throws Exception;
<add> default void beforeTestClass(TestContext testContext) throws Exception {
<add> /* no-op */
<add> }
<ide>
<ide> /**
<ide> * Prepares the {@link Object test instance} of the supplied
<ide> * {@link TestContext test context}, for example by injecting dependencies.
<ide> * <p>This method should be called immediately after instantiation of the test
<ide> * instance but prior to any framework-specific lifecycle callbacks.
<add> * <p>The default implementation is <em>empty</em>. Can be overridden by
<add> * concrete classes as necessary.
<ide> * @param testContext the test context for the test; never {@code null}
<ide> * @throws Exception allows any exception to propagate
<ide> */
<del> void prepareTestInstance(TestContext testContext) throws Exception;
<add> default void prepareTestInstance(TestContext testContext) throws Exception {
<add> /* no-op */
<add> }
<ide>
<ide> /**
<ide> * Pre-processes a test <em>before</em> execution of the
<ide> public interface TestExecutionListener {
<ide> * fixtures.
<ide> * <p>This method should be called immediately prior to framework-specific
<ide> * <em>before</em> lifecycle callbacks.
<add> * <p>The default implementation is <em>empty</em>. Can be overridden by
<add> * concrete classes as necessary.
<ide> * @param testContext the test context in which the test method will be
<ide> * executed; never {@code null}
<ide> * @throws Exception allows any exception to propagate
<ide> */
<del> void beforeTestMethod(TestContext testContext) throws Exception;
<add> default void beforeTestMethod(TestContext testContext) throws Exception {
<add> /* no-op */
<add> }
<ide>
<ide> /**
<ide> * Post-processes a test <em>after</em> execution of the
<ide> public interface TestExecutionListener {
<ide> * fixtures.
<ide> * <p>This method should be called immediately after framework-specific
<ide> * <em>after</em> lifecycle callbacks.
<add> * <p>The default implementation is <em>empty</em>. Can be overridden by
<add> * concrete classes as necessary.
<ide> * @param testContext the test context in which the test method was
<ide> * executed; never {@code null}
<ide> * @throws Exception allows any exception to propagate
<ide> */
<del> void afterTestMethod(TestContext testContext) throws Exception;
<add> default void afterTestMethod(TestContext testContext) throws Exception {
<add> /* no-op */
<add> }
<ide>
<ide> /**
<ide> * Post-processes a test class <em>after</em> execution of all tests within
<ide> public interface TestExecutionListener {
<ide> * <em>after class</em> lifecycle callbacks.
<ide> * <p>If a given testing framework does not support <em>after class</em>
<ide> * lifecycle callbacks, this method will not be called for that framework.
<add> * <p>The default implementation is <em>empty</em>. Can be overridden by
<add> * concrete classes as necessary.
<ide> * @param testContext the test context for the test; never {@code null}
<ide> * @throws Exception allows any exception to propagate
<ide> */
<del> void afterTestClass(TestContext testContext) throws Exception;
<add> default void afterTestClass(TestContext testContext) throws Exception {
<add> /* no-op */
<add> }
<ide>
<ide> }
<ide><path>spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2016 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> package org.springframework.test.context.support;
<ide>
<ide> import org.springframework.core.Ordered;
<del>import org.springframework.test.context.TestContext;
<ide> import org.springframework.test.context.TestExecutionListener;
<ide>
<ide> /**
<del> * Abstract implementation of the {@link TestExecutionListener} interface which
<del> * provides empty method stubs. Subclasses can extend this class and override
<del> * only those methods suitable for the task at hand.
<add> * Abstract {@linkplain Ordered ordered} implementation of the
<add> * {@link TestExecutionListener} API.
<ide> *
<ide> * @author Sam Brannen
<del> * @author Juergen Hoeller
<ide> * @since 2.5
<add> * @see #getOrder()
<ide> */
<ide> public abstract class AbstractTestExecutionListener implements TestExecutionListener, Ordered {
<ide>
<del> /**
<del> * The default implementation is <em>empty</em>. Can be overridden by
<del> * subclasses as necessary.
<del> */
<del> @Override
<del> public void beforeTestClass(TestContext testContext) throws Exception {
<del> /* no-op */
<del> }
<del>
<del> /**
<del> * The default implementation is <em>empty</em>. Can be overridden by
<del> * subclasses as necessary.
<del> */
<del> @Override
<del> public void prepareTestInstance(TestContext testContext) throws Exception {
<del> /* no-op */
<del> }
<del>
<del> /**
<del> * The default implementation is <em>empty</em>. Can be overridden by
<del> * subclasses as necessary.
<del> */
<del> @Override
<del> public void beforeTestMethod(TestContext testContext) throws Exception {
<del> /* no-op */
<del> }
<del>
<del> /**
<del> * The default implementation is <em>empty</em>. Can be overridden by
<del> * subclasses as necessary.
<del> */
<del> @Override
<del> public void afterTestMethod(TestContext testContext) throws Exception {
<del> /* no-op */
<del> }
<del>
<del> /**
<del> * The default implementation is <em>empty</em>. Can be overridden by
<del> * subclasses as necessary.
<del> */
<del> @Override
<del> public void afterTestClass(TestContext testContext) throws Exception {
<del> /* no-op */
<del> }
<del>
<ide> /**
<ide> * The default implementation returns {@link Ordered#LOWEST_PRECEDENCE},
<ide> * thereby ensuring that custom listeners are ordered after default | 2 |
Mixed | Python | remove trailing slash from cramer cursor link | 3e5a1397d72045bf9fe84fbbefa426ee31f5febc | <ide><path>docs/topics/3.1-announcement.md
<ide> Note that as a result of this work a number of settings keys and generic view at
<ide>
<ide> Until now, there has only been a single built-in pagination style in REST framework. We now have page, limit/offset and cursor based schemes included by default.
<ide>
<del>The cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for [this blog post](http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/) on the subject.
<add>The cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for [this blog post](http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api) on the subject.
<ide>
<ide> #### Pagination controls in the browsable API.
<ide>
<ide><path>rest_framework/pagination.py
<ide> class CursorPagination(BasePagination):
<ide> """
<ide> The cursor pagination implementation is neccessarily complex.
<ide> For an overview of the position/offset style we use, see this post:
<del> http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/
<add> http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api
<ide> """
<ide> cursor_query_param = 'cursor'
<ide> page_size = api_settings.PAGE_SIZE | 2 |
Mixed | Ruby | allow expires_in for activestorage signed ids | 1dc175338bd0cc9294be6a6e3027d468c31829c6 | <ide><path>activestorage/CHANGELOG.md
<add>* Allow `expires_in` for ActiveStorage signed ids.
<add>
<add> *aki77*
<add>
<ide> * Allow to purge an attachment when record is not persisted for `has_one_attached`
<ide>
<ide> *Jacopo Beschi*
<ide><path>activestorage/app/models/active_storage/blob.rb
<ide> def signed_id_verifier #:nodoc:
<ide> end
<ide>
<ide> # Returns a signed ID for this blob that's suitable for reference on the client-side without fear of tampering.
<del> def signed_id(purpose: :blob_id)
<add> def signed_id(purpose: :blob_id, expires_in: nil)
<ide> super
<ide> end
<ide>
<ide><path>activestorage/test/models/attachment_test.rb
<ide> class ActiveStorage::AttachmentTest < ActiveSupport::TestCase
<ide> assert_equal blob, ActiveStorage::Blob.find_signed!(signed_id, purpose: :custom_purpose)
<ide> end
<ide>
<add> test "getting a signed blob ID from an attachment with a expires_in" do
<add> blob = create_blob
<add> @user.avatar.attach(blob)
<add>
<add> signed_id = @user.avatar.signed_id(expires_in: 1.minute)
<add> assert_equal blob, ActiveStorage::Blob.find_signed!(signed_id)
<add> end
<add>
<add> test "fail to find blob within expiration date" do
<add> blob = create_blob
<add> @user.avatar.attach(blob)
<add>
<add> signed_id = @user.avatar.signed_id(expires_in: 1.minute)
<add> travel 2.minutes
<add> assert_nil ActiveStorage::Blob.find_signed(signed_id)
<add> end
<add>
<ide> test "signed blob ID backwards compatibility" do
<ide> blob = create_blob
<ide> @user.avatar.attach(blob) | 3 |
Javascript | Javascript | remove _ctor field from lazy components | fa03206ee4352431198b678c00dca83027e7052d | <ide><path>packages/react-dom/src/server/ReactPartialRenderer.js
<ide>
<ide> import type {ThreadID} from './ReactThreadIDAllocator';
<ide> import type {ReactElement} from 'shared/ReactElementType';
<del>import type {LazyComponent} from 'shared/ReactLazyComponent';
<add>import type {LazyComponent} from 'react/src/ReactLazy';
<ide> import type {ReactProvider, ReactContext} from 'shared/ReactTypes';
<ide>
<ide> import * as React from 'react';
<ide> import invariant from 'shared/invariant';
<ide> import getComponentName from 'shared/getComponentName';
<ide> import describeComponentFrame from 'shared/describeComponentFrame';
<ide> import ReactSharedInternals from 'shared/ReactSharedInternals';
<del>import {
<del> Resolved,
<del> Rejected,
<del> Pending,
<del> initializeLazyComponentType,
<del>} from 'shared/ReactLazyComponent';
<add>import {initializeLazyComponentType} from 'shared/ReactLazyComponent';
<add>import {Resolved, Rejected, Pending} from 'shared/ReactLazyStatusTags';
<ide> import {
<ide> warnAboutDeprecatedLifecycles,
<ide> disableLegacyContext,
<ide><path>packages/react-reconciler/src/ReactFiberLazyComponent.js
<ide> * @flow
<ide> */
<ide>
<del>import type {LazyComponent} from 'shared/ReactLazyComponent';
<add>import type {LazyComponent} from 'react/src/ReactLazy';
<ide>
<del>import {Resolved, initializeLazyComponentType} from 'shared/ReactLazyComponent';
<add>import {Resolved} from 'shared/ReactLazyStatusTags';
<add>import {initializeLazyComponentType} from 'shared/ReactLazyComponent';
<ide>
<ide> export function resolveDefaultProps(Component: any, baseProps: Object): Object {
<ide> if (Component && Component.defaultProps) {
<ide><path>packages/react/src/ReactLazy.js
<ide> *
<ide> * This source code is licensed under the MIT license found in the
<ide> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @flow
<ide> */
<ide>
<del>import type {LazyComponent, Thenable} from 'shared/ReactLazyComponent';
<del>
<ide> import {REACT_LAZY_TYPE} from 'shared/ReactSymbols';
<ide>
<del>export function lazy<T, R>(ctor: () => Thenable<T, R>): LazyComponent<T> {
<del> let lazyType = {
<add>type Thenable<T, R> = {
<add> then(resolve: (T) => mixed, reject: (mixed) => mixed): R,
<add>};
<add>
<add>export type UninitializedLazyComponent<T> = {
<add> $$typeof: Symbol | number,
<add> _status: -1,
<add> _result: () => Thenable<{default: T, ...} | T, mixed>,
<add>};
<add>
<add>export type PendingLazyComponent<T> = {
<add> $$typeof: Symbol | number,
<add> _status: 0,
<add> _result: Thenable<{default: T, ...} | T, mixed>,
<add>};
<add>
<add>export type ResolvedLazyComponent<T> = {
<add> $$typeof: Symbol | number,
<add> _status: 1,
<add> _result: T,
<add>};
<add>
<add>export type RejectedLazyComponent = {
<add> $$typeof: Symbol | number,
<add> _status: 2,
<add> _result: mixed,
<add>};
<add>
<add>export type LazyComponent<T> =
<add> | UninitializedLazyComponent<T>
<add> | PendingLazyComponent<T>
<add> | ResolvedLazyComponent<T>
<add> | RejectedLazyComponent;
<add>
<add>export function lazy<T>(
<add> ctor: () => Thenable<{default: T, ...} | T, mixed>,
<add>): LazyComponent<T> {
<add> let lazyType: LazyComponent<T> = {
<ide> $$typeof: REACT_LAZY_TYPE,
<del> _ctor: ctor,
<ide> // React uses these fields to store the result.
<ide> _status: -1,
<del> _result: null,
<add> _result: ctor,
<ide> };
<ide>
<ide> if (__DEV__) {
<ide> // In production, this would just set it on the object.
<ide> let defaultProps;
<ide> let propTypes;
<add> // $FlowFixMe
<ide> Object.defineProperties(lazyType, {
<ide> defaultProps: {
<ide> configurable: true,
<ide> export function lazy<T, R>(ctor: () => Thenable<T, R>): LazyComponent<T> {
<ide> );
<ide> defaultProps = newDefaultProps;
<ide> // Match production behavior more closely:
<add> // $FlowFixMe
<ide> Object.defineProperty(lazyType, 'defaultProps', {
<ide> enumerable: true,
<ide> });
<ide> export function lazy<T, R>(ctor: () => Thenable<T, R>): LazyComponent<T> {
<ide> );
<ide> propTypes = newPropTypes;
<ide> // Match production behavior more closely:
<add> // $FlowFixMe
<ide> Object.defineProperty(lazyType, 'propTypes', {
<ide> enumerable: true,
<ide> });
<ide><path>packages/shared/ReactLazyComponent.js
<ide> * @flow
<ide> */
<ide>
<del>export type Thenable<T, R> = {
<del> then(resolve: (T) => mixed, reject: (mixed) => mixed): R,
<del> ...
<del>};
<add>import type {
<add> PendingLazyComponent,
<add> ResolvedLazyComponent,
<add> RejectedLazyComponent,
<add> LazyComponent,
<add>} from 'react/src/ReactLazy';
<ide>
<del>export type LazyComponent<T> = {
<del> $$typeof: Symbol | number,
<del> _ctor: () => Thenable<{default: T, ...}, mixed>,
<del> _status: 0 | 1 | 2,
<del> _result: any,
<del> ...
<del>};
<del>
<del>type ResolvedLazyComponent<T> = {
<del> $$typeof: Symbol | number,
<del> _ctor: () => Thenable<{default: T, ...}, mixed>,
<del> _status: 1,
<del> _result: any,
<del> ...
<del>};
<del>
<del>export const Uninitialized = -1;
<del>export const Pending = 0;
<del>export const Resolved = 1;
<del>export const Rejected = 2;
<add>import {
<add> Uninitialized,
<add> Pending,
<add> Resolved,
<add> Rejected,
<add>} from './ReactLazyStatusTags';
<ide>
<ide> export function refineResolvedLazyComponent<T>(
<ide> lazyComponent: LazyComponent<T>,
<del>): ResolvedLazyComponent<T> | null {
<add>): T | null {
<ide> return lazyComponent._status === Resolved ? lazyComponent._result : null;
<ide> }
<ide>
<ide> export function initializeLazyComponentType(
<ide> lazyComponent: LazyComponent<any>,
<ide> ): void {
<ide> if (lazyComponent._status === Uninitialized) {
<del> lazyComponent._status = Pending;
<del> const ctor = lazyComponent._ctor;
<add> let ctor = lazyComponent._result;
<add> if (!ctor) {
<add> // TODO: Remove this later. THis only exists in case you use an older "react" package.
<add> ctor = ((lazyComponent: any)._ctor: typeof ctor);
<add> }
<ide> const thenable = ctor();
<del> lazyComponent._result = thenable;
<add> // Transition to the next state.
<add> const pending: PendingLazyComponent<any> = (lazyComponent: any);
<add> pending._status = Pending;
<add> pending._result = thenable;
<ide> thenable.then(
<ide> moduleObject => {
<ide> if (lazyComponent._status === Pending) {
<ide> export function initializeLazyComponentType(
<ide> );
<ide> }
<ide> }
<del> lazyComponent._status = Resolved;
<del> lazyComponent._result = defaultExport;
<add> // Transition to the next state.
<add> const resolved: ResolvedLazyComponent<any> = (lazyComponent: any);
<add> resolved._status = Resolved;
<add> resolved._result = defaultExport;
<ide> }
<ide> },
<ide> error => {
<ide> if (lazyComponent._status === Pending) {
<del> lazyComponent._status = Rejected;
<del> lazyComponent._result = error;
<add> // Transition to the next state.
<add> const rejected: RejectedLazyComponent = (lazyComponent: any);
<add> rejected._status = Rejected;
<add> rejected._result = error;
<ide> }
<ide> },
<ide> );
<ide><path>packages/shared/ReactLazyStatusTags.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @flow
<add> */
<add>
<add>// TODO: Move this to "react" once we can import from externals.
<add>export const Uninitialized = -1;
<add>export const Pending = 0;
<add>export const Resolved = 1;
<add>export const Rejected = 2;
<ide><path>packages/shared/getComponentName.js
<ide> * @flow
<ide> */
<ide>
<del>import type {LazyComponent} from 'shared/ReactLazyComponent';
<add>import type {LazyComponent} from 'react/src/ReactLazy';
<ide>
<ide> import {
<ide> REACT_CONTEXT_TYPE, | 6 |
Text | Text | update env default on child_process functions | 329355986dcfd92d079037dfe42ccb5443c8029d | <ide><path>doc/api/child_process.md
<ide> changes:
<ide> * `options` {Object}
<ide> * `cwd` {string} Current working directory of the child process.
<ide> **Default:** `null`.
<del> * `env` {Object} Environment key-value pairs. **Default:** `null`.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `encoding` {string} **Default:** `'utf8'`
<ide> * `shell` {string} Shell to execute the command with. See
<ide> [Shell Requirements][] and [Default Windows Shell][]. **Default:**
<ide> changes:
<ide> * `args` {string[]} List of string arguments.
<ide> * `options` {Object}
<ide> * `cwd` {string} Current working directory of the child process.
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `encoding` {string} **Default:** `'utf8'`
<ide> * `timeout` {number} **Default:** `0`
<ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
<ide> changes:
<ide> * `detached` {boolean} Prepare child to run independently of its parent
<ide> process. Specific behavior depends on the platform, see
<ide> [`options.detached`][]).
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `execPath` {string} Executable used to create the child process.
<ide> * `execArgv` {string[]} List of string arguments passed to the executable.
<ide> **Default:** `process.execArgv`.
<ide> changes:
<ide> * `args` {string[]} List of string arguments.
<ide> * `options` {Object}
<ide> * `cwd` {string} Current working directory of the child process.
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child
<ide> process. This will be set to `command` if not specified.
<ide> * `stdio` {Array|string} Child's stdio configuration (see
<ide> changes:
<ide> * `stdio` {string|Array} Child's stdio configuration. `stderr` by default will
<ide> be output to the parent process' stderr unless `stdio` is specified.
<ide> **Default:** `'pipe'`.
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `uid` {number} Sets the user identity of the process (see setuid(2)).
<ide> * `gid` {number} Sets the group identity of the process (see setgid(2)).
<ide> * `timeout` {number} In milliseconds the maximum amount of time the process
<ide> changes:
<ide> * `stdio` {string|Array} Child's stdio configuration. `stderr` by default will
<ide> be output to the parent process' stderr unless `stdio` is specified.
<ide> **Default:** `'pipe'`.
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `shell` {string} Shell to execute the command with. See
<ide> [Shell Requirements][] and [Default Windows Shell][]. **Default:**
<ide> `'/bin/sh'` on Unix, `process.env.ComSpec` on Windows.
<ide> changes:
<ide> * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child
<ide> process. This will be set to `command` if not specified.
<ide> * `stdio` {string|Array} Child's stdio configuration.
<del> * `env` {Object} Environment key-value pairs.
<add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`.
<ide> * `uid` {number} Sets the user identity of the process (see setuid(2)).
<ide> * `gid` {number} Sets the group identity of the process (see setgid(2)).
<ide> * `timeout` {number} In milliseconds the maximum amount of time the process | 1 |
Go | Go | avoid cgo in collector | cf104d85c35947c25dcd86cef19aa97fe31e4bbd | <ide><path>daemon/stats/collector_unix.go
<ide> import (
<ide> "strings"
<ide>
<ide> "github.com/opencontainers/runc/libcontainer/system"
<add> "golang.org/x/sys/unix"
<ide> )
<ide>
<del>/*
<del>#include <unistd.h>
<del>*/
<del>import "C"
<del>
<ide> // platformNewStatsCollector performs platform specific initialisation of the
<ide> // Collector structure.
<ide> func platformNewStatsCollector(s *Collector) {
<ide> func (s *Collector) getSystemCPUUsage() (uint64, error) {
<ide> }
<ide>
<ide> func (s *Collector) getNumberOnlineCPUs() (uint32, error) {
<del> i, err := C.sysconf(C._SC_NPROCESSORS_ONLN)
<del> // According to POSIX - errno is undefined after successful
<del> // sysconf, and can be non-zero in several cases, so look for
<del> // error in returned value not in errno.
<del> // (https://sourceware.org/bugzilla/show_bug.cgi?id=21536)
<del> if i == -1 {
<add> var cpuset unix.CPUSet
<add> err := unix.SchedGetaffinity(0, &cpuset)
<add> if err != nil {
<ide> return 0, err
<ide> }
<del> return uint32(i), nil
<add> return uint32(cpuset.Count()), nil
<ide> } | 1 |
Javascript | Javascript | use proptypes directly | bf752014a988bb6639a9f9993dd25cc70799cfae | <ide><path>Libraries/Components/MaskedView/MaskedViewIOS.ios.js
<ide> const StyleSheet = require('StyleSheet');
<ide> const View = require('View');
<ide> const ViewPropTypes = require('ViewPropTypes');
<ide> const requireNativeComponent = require('requireNativeComponent');
<del>const ReactPropTypes = PropTypes;
<ide>
<ide> import type { ViewProps } from 'ViewPropTypes';
<ide>
<ide> class MaskedViewIOS extends React.Component {
<ide>
<ide> static propTypes = {
<ide> ...ViewPropTypes,
<del> maskElement: ReactPropTypes.element.isRequired,
<add> maskElement: PropTypes.element.isRequired,
<ide> };
<ide>
<ide> _hasWarnedInvalidRenderMask = false; | 1 |
Go | Go | fix typos in service.go and plugin.go | c80e20f93f9b311749a67766b52da53ed8002347 | <ide><path>daemon/cluster/convert/service.go
<ide> func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
<ide> }
<ide> case types.RuntimeNetworkAttachment:
<ide> // NOTE(dperny) I'm leaving this case here for completeness. The actual
<del> // code is left out out deliberately, as we should refuse to parse a
<add> // code is left out deliberately, as we should refuse to parse a
<ide> // Network Attachment runtime; it will cause weird behavior all over
<ide> // the system if we do. Instead, fallthrough and return
<ide> // ErrUnsupportedRuntime if we get one.
<ide><path>internal/test/fixtures/plugin/plugin.go
<ide> import (
<ide> "github.com/pkg/errors"
<ide> )
<ide>
<del>// CreateOpt is is passed used to change the default plugin config before
<add>// CreateOpt is passed used to change the default plugin config before
<ide> // creating it
<ide> type CreateOpt func(*Config)
<ide> | 2 |
Python | Python | check weight dimensions better in write_images | fdd822c03ed8eeb03e18de931d1694e10cc01ea1 | <ide><path>keras/callbacks.py
<ide> def set_model(self, model):
<ide> tf.summary.histogram(weight.name, weight)
<ide> if self.write_images:
<ide> w_img = tf.squeeze(weight)
<del> shape = w_img.get_shape()
<del> if len(shape) > 1 and shape[0] > shape[1]:
<del> w_img = tf.transpose(w_img)
<del> if len(shape) == 1:
<del> w_img = tf.expand_dims(w_img, 0)
<del> w_img = tf.expand_dims(tf.expand_dims(w_img, 0), -1)
<add> shape = K.int_shape(w_img)
<add> if len(shape) == 2: # dense layer kernel case
<add> if shape[0] > shape[1]:
<add> w_img = tf.transpose(w_img)
<add> shape = K.int_shape(w_img)
<add> w_img = tf.reshape(w_img, [1,
<add> shape[0],
<add> shape[1],
<add> 1])
<add> elif len(shape) == 3: # convnet case
<add> if K.image_data_format() == 'channels_last':
<add> # switch to channels_first to display
<add> # every kernel as a separate image
<add> w_img = tf.transpose(w_img, perm=[2, 0, 1])
<add> shape = K.int_shape(w_img)
<add> w_img = tf.reshape(w_img, [shape[0],
<add> shape[1],
<add> shape[2],
<add> 1])
<add> elif len(shape) == 1: # bias case
<add> w_img = tf.reshape(w_img, [1,
<add> shape[0],
<add> 1,
<add> 1])
<add> else:
<add> # not possible to handle 3D convnets etc.
<add> continue
<add>
<add> shape = K.int_shape(w_img)
<add> assert len(shape) == 4 and shape[-1] in [1, 3, 4]
<ide> tf.summary.image(weight.name, w_img)
<ide>
<ide> if hasattr(layer, 'output'):
<ide><path>tests/keras/test_callbacks.py
<ide> from keras import callbacks
<ide> from keras.models import Sequential
<ide> from keras.layers.core import Dense
<add>from keras.layers.convolutional import Conv2D
<add>from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling2D
<ide> from keras.utils.test_utils import get_test_data
<ide> from keras.utils.test_utils import keras_test
<ide> from keras import backend as K
<ide> def data_generator_graph(train):
<ide> shutil.rmtree(filepath)
<ide>
<ide>
<add>@keras_test
<add>@pytest.mark.skipif((K.backend() != 'tensorflow'),
<add> reason='Requires tensorflow backend')
<add>def test_TensorBoard_convnet():
<add> np.random.seed(1337)
<add>
<add> filepath = './logs'
<add> input_shape = (16, 16, 3)
<add> (x_train, y_train), (x_test, y_test) = get_test_data(num_train=500,
<add> num_test=200,
<add> input_shape=input_shape,
<add> classification=True,
<add> num_classes=4)
<add> y_train = np_utils.to_categorical(y_train)
<add> y_test = np_utils.to_categorical(y_test)
<add>
<add> model = Sequential([
<add> Conv2D(filters=8, kernel_size=3,
<add> activation='relu',
<add> input_shape=input_shape),
<add> MaxPooling2D(pool_size=2),
<add> Conv2D(filters=4, kernel_size=(3, 3),
<add> activation='relu', padding='same'),
<add> GlobalAveragePooling2D(),
<add> Dense(y_test.shape[-1], activation='softmax')
<add> ])
<add> model.compile(loss='categorical_crossentropy',
<add> optimizer='rmsprop',
<add> metrics=['accuracy'])
<add> tsb = callbacks.TensorBoard(log_dir=filepath, histogram_freq=1,
<add> write_images=True)
<add> cbks = [tsb]
<add> model.summary()
<add> history = model.fit(x_train, y_train, epochs=2, batch_size=16,
<add> validation_data=(x_test, y_test),
<add> callbacks=cbks,
<add> verbose=0)
<add> assert os.path.exists(filepath)
<add> shutil.rmtree(filepath)
<add>
<add>
<ide> @keras_test
<ide> def test_LambdaCallback():
<ide> np.random.seed(1337) | 2 |
PHP | PHP | remove unused fixtures | 59b638a1aa206ecacfc98f5b3b379d17bcc117c7 | <ide><path>tests/Fixture/AccountFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AccountFixture extends TestFixture {
<del>
<del> public $table = 'Accounts';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'iAccountId' => ['type' => 'integer'],
<del> 'cDescription' => ['type' => 'string', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['iAccountId']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('cDescription' => 'gwoo'),
<del> array('cDescription' => 'phpnut'),
<del> array('cDescription' => 'schreck'),
<del> array('cDescription' => 'dude')
<del> );
<del>}
<ide><path>tests/Fixture/AcoActionFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AcoActionFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'model' => ['type' => 'string', 'default' => ''],
<del> 'foreign_key' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'alias' => ['type' => 'string', 'default' => ''],
<del> 'lft' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'rght' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array();
<del>}
<ide><path>tests/Fixture/AcoFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AcoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'model' => ['type' => 'string', 'null' => true],
<del> 'foreign_key' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'alias' => ['type' => 'string', 'default' => ''],
<del> 'lft' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'rght' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 24),
<del> array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller1', 'lft' => 2, 'rght' => 9),
<del> array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 3, 'rght' => 6),
<del> array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 4, 'rght' => 5),
<del> array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 7, 'rght' => 8),
<del> array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller2', 'lft' => 10, 'rght' => 17),
<del> array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 11, 'rght' => 14),
<del> array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 12, 'rght' => 13),
<del> array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
<del> array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 18, 'rght' => 23),
<del> array('parent_id' => 9, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 19, 'rght' => 22),
<del> array('parent_id' => 10, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 20, 'rght' => 21),
<del> );
<del>}
<ide><path>tests/Fixture/AcoTwoFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AcoTwoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'model' => ['type' => 'string', 'null' => true],
<del> 'foreign_key' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'alias' => ['type' => 'string', 'default' => ''],
<del> 'lft' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'rght' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 20),
<del> array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports', 'lft' => 2, 'rght' => 9),
<del> array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 3, 'rght' => 6),
<del> array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'current', 'lft' => 4, 'rght' => 5),
<del> array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'update', 'lft' => 7, 'rght' => 8),
<del> array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'printers', 'lft' => 10, 'rght' => 19),
<del> array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'print', 'lft' => 11, 'rght' => 14),
<del> array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'lettersize', 'lft' => 12, 'rght' => 13),
<del> array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'refill', 'lft' => 15, 'rght' => 16),
<del> array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'smash', 'lft' => 17, 'rght' => 18),
<del> );
<del>}
<ide><path>tests/Fixture/AdFixture.php
<del><?php
<del>/**
<del> * Short description for ad_fixture.php
<del> *
<del> * Long description for ad_fixture.php
<del> *
<del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://www.cakephp.org
<del> * @since 1.2
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * AdFixture class
<del> *
<del> */
<del>class AdFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'campaign_id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer'],
<del> 'lft' => ['type' => 'integer'],
<del> 'rght' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => null, 'lft' => 1, 'rght' => 2, 'campaign_id' => 1, 'name' => 'Nordover'),
<del> array('parent_id' => null, 'lft' => 3, 'rght' => 4, 'campaign_id' => 1, 'name' => 'Statbergen'),
<del> array('parent_id' => null, 'lft' => 5, 'rght' => 6, 'campaign_id' => 1, 'name' => 'Feroy'),
<del> array('parent_id' => null, 'lft' => 7, 'rght' => 12, 'campaign_id' => 2, 'name' => 'Newcastle'),
<del> array('parent_id' => null, 'lft' => 8, 'rght' => 9, 'campaign_id' => 2, 'name' => 'Dublin'),
<del> array('parent_id' => null, 'lft' => 10, 'rght' => 11, 'campaign_id' => 2, 'name' => 'Alborg'),
<del> array('parent_id' => null, 'lft' => 13, 'rght' => 14, 'campaign_id' => 3, 'name' => 'New York')
<del> );
<del>}
<ide><path>tests/Fixture/AdvertisementFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AdvertisementFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Ad', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('title' => 'Second Ad', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')
<del> );
<del>}
<ide><path>tests/Fixture/AnotherArticleFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AnotherArticleFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Article', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('title' => 'Second Article', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> array('title' => 'Third Article', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')
<del> );
<del>}
<ide><path>tests/Fixture/AppleFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AppleFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'apple_id' => ['type' => 'integer', 'null' => true],
<del> 'color' => ['type' => 'string', 'length' => 40, 'null' => false],
<del> 'name' => ['type' => 'string', 'length' => 40, 'null' => false],
<del> 'created' => 'datetime',
<del> 'date' => 'date',
<del> 'modified' => 'datetime',
<del> 'mytime' => 'time',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('apple_id' => 2, 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
<del> array('apple_id' => 1, 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
<del> array('apple_id' => 2, 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
<del> array('apple_id' => 2, 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
<del> array('apple_id' => 5, 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
<del> array('apple_id' => 4, 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
<del> array('apple_id' => 6, 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
<del> );
<del>}
<ide><path>tests/Fixture/ArmorFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArmorFixture extends TestFixture {
<del>
<del>/**
<del> * Datasource
<del> *
<del> * Used for Multi database fixture test
<del> *
<del> * @var string 'test2'
<del> */
<del> public $useDbConfig = 'test2';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Leather', 'created' => '2007-03-17 01:16:23'),
<del> array('name' => 'Chainmail', 'created' => '2007-03-17 01:18:23'),
<del> array('name' => 'Cloak', 'created' => '2007-03-17 01:20:23'),
<del> array('name' => 'Bikini', 'created' => '2007-03-17 01:22:23'),
<del> );
<del>}
<ide><path>tests/Fixture/ArmorsPlayerFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArmorsPlayerFixture extends TestFixture {
<del>
<del>/**
<del> * Datasource
<del> *
<del> * Used for Multi database fixture test
<del> *
<del> * @var string 'test_database_three'
<del> */
<del> public $useDbConfig = 'test_database_three';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'player_id' => ['type' => 'integer', 'null' => false],
<del> 'armor_id' => ['type' => 'integer', 'null' => false],
<del> 'broken' => ['type' => 'boolean', 'null' => false, 'default' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('player_id' => 1, 'armor_id' => 1, 'broken' => false),
<del> array('player_id' => 2, 'armor_id' => 2, 'broken' => false),
<del> array('player_id' => 3, 'armor_id' => 3, 'broken' => false),
<del> );
<del>}
<ide><path>tests/Fixture/AroFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AroFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'model' => ['type' => 'string', 'null' => true],
<del> 'foreign_key' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'alias' => ['type' => 'string', 'default' => ''],
<del> 'lft' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'rght' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 8),
<del> array('parent_id' => '1', 'model' => 'Group', 'foreign_key' => '1', 'alias' => 'admins', 'lft' => 2, 'rght' => 7),
<del> array('parent_id' => '2', 'model' => 'AuthUser', 'foreign_key' => '1', 'alias' => 'Gandalf', 'lft' => 3, 'rght' => 4),
<del> array('parent_id' => '2', 'model' => 'AuthUser', 'foreign_key' => '2', 'alias' => 'Elrond', 'lft' => 5, 'rght' => 6)
<del> );
<del>}
<ide><path>tests/Fixture/AroTwoFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class AroTwoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'parent_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'model' => ['type' => 'string', 'null' => true],
<del> 'foreign_key' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'alias' => ['type' => 'string', 'default' => ''],
<del> 'lft' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'rght' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'root', 'lft' => '1', 'rght' => '20'),
<del> array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '1', 'alias' => 'admin', 'lft' => '2', 'rght' => '5'),
<del> array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '2', 'alias' => 'managers', 'lft' => '6', 'rght' => '9'),
<del> array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '3', 'alias' => 'users', 'lft' => '10', 'rght' => '19'),
<del> array('parent_id' => 2, 'model' => 'User', 'foreign_key' => '1', 'alias' => 'Bobs', 'lft' => '3', 'rght' => '4'),
<del> array('parent_id' => 3, 'model' => 'User', 'foreign_key' => '2', 'alias' => 'Lumbergh', 'lft' => '7', 'rght' => '8'),
<del> array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '3', 'alias' => 'Samir', 'lft' => '11', 'rght' => '12'),
<del> array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '4', 'alias' => 'Micheal', 'lft' => '13', 'rght' => '14'),
<del> array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '5', 'alias' => 'Peter', 'lft' => '15', 'rght' => '16'),
<del> array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '6', 'alias' => 'Milton', 'lft' => '17', 'rght' => '18'),
<del> );
<del>}
<ide><path>tests/Fixture/ArosAcoFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArosAcoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'aro_id' => ['type' => 'integer', 'length' => 10, 'null' => false],
<del> 'aco_id' => ['type' => 'integer', 'length' => 10, 'null' => false],
<del> '_create' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_read' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_update' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_delete' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array();
<del>}
<ide><path>tests/Fixture/ArosAcoTwoFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArosAcoTwoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'aro_id' => ['type' => 'integer', 'length' => 10, 'null' => false],
<del> 'aco_id' => ['type' => 'integer', 'length' => 10, 'null' => false],
<del> '_create' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_read' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_update' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_delete' => ['type' => 'string', 'length' => 2, 'default' => 0],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('aro_id' => '1', 'aco_id' => '1', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
<del> array('aro_id' => '2', 'aco_id' => '1', '_create' => '0', '_read' => '1', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '3', 'aco_id' => '2', '_create' => '0', '_read' => '1', '_update' => '0', '_delete' => '0'),
<del> array('aro_id' => '4', 'aco_id' => '2', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '-1'),
<del> array('aro_id' => '4', 'aco_id' => '6', '_create' => '1', '_read' => '1', '_update' => '0', '_delete' => '0'),
<del> array('aro_id' => '5', 'aco_id' => '1', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '6', 'aco_id' => '3', '_create' => '-1', '_read' => '1', '_update' => '-1', '_delete' => '-1'),
<del> array('aro_id' => '6', 'aco_id' => '4', '_create' => '-1', '_read' => '1', '_update' => '-1', '_delete' => '1'),
<del> array('aro_id' => '6', 'aco_id' => '6', '_create' => '-1', '_read' => '1', '_update' => '1', '_delete' => '-1'),
<del> array('aro_id' => '7', 'aco_id' => '2', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
<del> array('aro_id' => '7', 'aco_id' => '7', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '0'),
<del> array('aro_id' => '7', 'aco_id' => '8', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '0'),
<del> array('aro_id' => '7', 'aco_id' => '9', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '7', 'aco_id' => '10', '_create' => '0', '_read' => '0', '_update' => '0', '_delete' => '1'),
<del> array('aro_id' => '8', 'aco_id' => '10', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '8', 'aco_id' => '2', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
<del> array('aro_id' => '9', 'aco_id' => '4', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '-1'),
<del> array('aro_id' => '9', 'aco_id' => '9', '_create' => '0', '_read' => '0', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '10', 'aco_id' => '9', '_create' => '1', '_read' => '1', '_update' => '1', '_delete' => '1'),
<del> array('aro_id' => '10', 'aco_id' => '10', '_create' => '-1', '_read' => '-1', '_update' => '-1', '_delete' => '-1'),
<del> );
<del>}
<ide><path>tests/Fixture/ArticleFeaturedFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArticleFeaturedFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'user_id' => ['type' => 'integer', 'null' => false],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> 'body' => 'text',
<del> 'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('user_id' => 1, 'title' => 'First Article', 'body' => 'First Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('user_id' => 3, 'title' => 'Second Article', 'body' => 'Second Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> array('user_id' => 1, 'title' => 'Third Article', 'body' => 'Third Article Body', 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')
<del> );
<del>}
<ide><path>tests/Fixture/ArticleFeaturedsTagsFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ArticleFeaturedsTagsFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'article_featured_id' => ['type' => 'integer', 'null' => false],
<del> 'tag_id' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['UNIQUE_FEATURED' => ['type' => 'unique', 'columns' => ['article_featured_id', 'tag_id']]]
<del> );
<del>}
<ide><path>tests/Fixture/BasketFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BasketFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'type' => ['type' => 'string', 'length' => 255],
<del> 'name' => ['type' => 'string', 'length' => 255],
<del> 'object_id' => ['type' => 'integer'],
<del> 'user_id' => ['type' => 'integer'],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'type' => 'nonfile', 'name' => 'basket1', 'object_id' => 1, 'user_id' => 1),
<del> array('id' => 2, 'type' => 'file', 'name' => 'basket2', 'object_id' => 2, 'user_id' => 1),
<del> );
<del>}
<ide><path>tests/Fixture/BidFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BidFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'message_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('message_id' => 1, 'name' => 'Bid 1.1'),
<del> array('message_id' => 1, 'name' => 'Bid 1.2'),
<del> array('message_id' => 3, 'name' => 'Bid 3.1'),
<del> array('message_id' => 2, 'name' => 'Bid 2.1'),
<del> array('message_id' => 2, 'name' => 'Bid 2.2')
<del> );
<del>}
<ide><path>tests/Fixture/BiddingFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.3.14
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BiddingFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'bid' => ['type' => 'string', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('bid' => 'One', 'name' => 'Bid 1'),
<del> array('bid' => 'Two', 'name' => 'Bid 2'),
<del> array('bid' => 'Three', 'name' => 'Bid 3'),
<del> array('bid' => 'Five', 'name' => 'Bid 5')
<del> );
<del>}
<ide><path>tests/Fixture/BiddingMessageFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.3.14
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BiddingMessageFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'bidding' => ['type' => 'string', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['bidding']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('bidding' => 'One', 'name' => 'Message 1'),
<del> array('bidding' => 'Two', 'name' => 'Message 2'),
<del> array('bidding' => 'Three', 'name' => 'Message 3'),
<del> array('bidding' => 'Four', 'name' => 'Message 4')
<del> );
<del>}
<ide><path>tests/Fixture/BookFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.7198
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class BookFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'isbn' => ['type' => 'string', 'length' => 13],
<del> 'title' => ['type' => 'string', 'length' => 255],
<del> 'author' => ['type' => 'string', 'length' => 255],
<del> 'year' => ['type' => 'integer', 'null' => true],
<del> 'pages' => ['type' => 'integer', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'isbn' => '1234567890', 'title' => 'Faust', 'author' => 'Johann Wolfgang von Goethe')
<del> );
<del>}
<ide><path>tests/Fixture/CacheTestModelFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * PHP 5
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CacheTestModelFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'string', 'length' => 255],
<del> 'data' => ['type' => 'string', 'length' => 255, 'default' => ''],
<del> 'expires' => ['type' => 'integer', 'length' => 10, 'default' => '0'],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>}
<ide><path>tests/Fixture/CallbackFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CallbackFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'user' => ['type' => 'string', 'null' => false],
<del> 'password' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('user' => 'user1', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('user' => 'user2', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31'),
<del> array('user' => 'user3', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:22:23', 'updated' => '2007-03-17 01:24:31'),
<del> );
<del>}
<ide><path>tests/Fixture/CampaignFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * PHP 5
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since 1.2
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * CampaignFixture class
<del> *
<del> */
<del>class CampaignFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Hurtigruten'),
<del> array('name' => 'Colorline'),
<del> array('name' => 'Queen of Scandinavia')
<del> );
<del>}
<ide><path>tests/Fixture/CdFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.7198
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CdFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'length' => 255],
<del> 'artist' => ['type' => 'string', 'length' => 255, 'null' => true],
<del> 'genre' => ['type' => 'string', 'length' => 255, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'title' => 'Grace', 'artist' => 'Jeff Buckley', 'genre' => 'awesome')
<del> );
<del>}
<ide><path>tests/Fixture/ContentAccountFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ContentAccountFixture extends TestFixture {
<del>
<del> public $table = 'ContentAccounts';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'iContentAccountsId' => ['type' => 'integer'],
<del> 'iContentId' => ['type' => 'integer'],
<del> 'iAccountId' => ['type' => 'integer'],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['iContentAccountsId']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('iContentId' => 1, 'iAccountId' => 1),
<del> array('iContentId' => 2, 'iAccountId' => 2),
<del> array('iContentId' => 3, 'iAccountId' => 3),
<del> array('iContentId' => 4, 'iAccountId' => 4),
<del> array('iContentId' => 1, 'iAccountId' => 2),
<del> array('iContentId' => 2, 'iAccountId' => 3),
<del> );
<del>}
<ide><path>tests/Fixture/ContentFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ContentFixture extends TestFixture {
<del>
<del> public $table = 'Content';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'iContentId' => ['type' => 'integer'],
<del> 'cDescription' => ['type' => 'string', 'length' => 50, 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['iContentId']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('cDescription' => 'Test Content 1'),
<del> array('cDescription' => 'Test Content 2'),
<del> array('cDescription' => 'Test Content 3'),
<del> array('cDescription' => 'Test Content 4')
<del> );
<del>}
<ide><path>tests/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CounterCachePostNonstandardPrimaryKeyFixture extends TestFixture {
<del>
<del> public $fields = array(
<del> 'pid' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> 'uid' => ['type' => 'integer', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['pid']]]
<del> );
<del>
<del> public $records = array(
<del> array('pid' => 1, 'title' => 'Rock and Roll', 'uid' => 66),
<del> array('pid' => 2, 'title' => 'Music', 'uid' => 66),
<del> array('pid' => 3, 'title' => 'Food', 'uid' => 301),
<del> );
<del>}
<ide><path>tests/Fixture/CounterCacheUserNonstandardPrimaryKeyFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class CounterCacheUserNonstandardPrimaryKeyFixture extends TestFixture {
<del>
<del> public $fields = array(
<del> 'uid' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> 'post_count' => ['type' => 'integer', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['uid']]]
<del> );
<del>
<del> public $records = array(
<del> array('uid' => 66, 'name' => 'Alexander', 'post_count' => 2),
<del> array('uid' => 301, 'name' => 'Steven', 'post_count' => 1),
<del> );
<del>}
<ide><path>tests/Fixture/DependencyFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://cakephp.org CakePHP(tm) Project
<del> * @since CakePHP(tm) v 1.2.0.6879//Correct version number as needed**
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for file.
<del> *
<del> * @since CakePHP(tm) v 1.2.0.6879//Correct version number as needed**
<del> */
<del>class DependencyFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'child_id' => 'integer',
<del> 'parent_id' => 'integer'
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('child_id' => 1, 'parent_id' => 2),
<del> );
<del>}
<ide><path>tests/Fixture/DeviceFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DeviceFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'device_type_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'typ' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1),
<del> array('device_type_id' => 1, 'name' => 'Device 2', 'typ' => 1),
<del> array('device_type_id' => 1, 'name' => 'Device 3', 'typ' => 2)
<del> );
<del>}
<ide><path>tests/Fixture/DeviceTypeCategoryFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DeviceTypeCategoryFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'DeviceTypeCategory 1')
<del> );
<del>}
<ide><path>tests/Fixture/DeviceTypeFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DeviceTypeFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'device_type_category_id' => ['type' => 'integer', 'null' => false],
<del> 'feature_set_id' => ['type' => 'integer', 'null' => false],
<del> 'exterior_type_category_id' => ['type' => 'integer', 'null' => false],
<del> 'image_id' => ['type' => 'integer', 'null' => false],
<del> 'extra1_id' => ['type' => 'integer', 'null' => false],
<del> 'extra2_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'order' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('device_type_category_id' => 1, 'feature_set_id' => 1, 'exterior_type_category_id' => 1, 'image_id' => 1, 'extra1_id' => 1, 'extra2_id' => 1, 'name' => 'DeviceType 1', 'order' => 0)
<del> );
<del>}
<ide><path>tests/Fixture/DocumentDirectoryFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DocumentDirectoryFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'DocumentDirectory 1')
<del> );
<del>}
<ide><path>tests/Fixture/DocumentFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DocumentFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'document_directory_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('document_directory_id' => 1, 'name' => 'Document 1')
<del> );
<del>}
<ide><path>tests/Fixture/DomainFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DomainFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'domain' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('domain' => 'cakephp.org', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('domain' => 'book.cakephp.org', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('domain' => 'api.cakephp.org', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('domain' => 'mark-story.com', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('domain' => 'tinadurocher.com', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('domain' => 'chavik.com', 'created' => '2001-02-03 00:01:02', 'updated' => '2007-03-17 01:22:31'),
<del> array('domain' => 'xintesa.com', 'created' => '2001-02-03 00:01:02', 'updated' => '2007-03-17 01:22:31'),
<del> );
<del>}
<ide><path>tests/Fixture/DomainsSiteFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class DomainsSiteFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'domain_id' => ['type' => 'integer', 'null' => false],
<del> 'site_id' => ['type' => 'integer', 'null' => false],
<del> 'active' => ['type' => 'boolean', 'null' => false, 'default' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('site_id' => 1, 'domain_id' => 1, 'active' => true, 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('site_id' => 1, 'domain_id' => 2, 'active' => true, 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('site_id' => 2, 'domain_id' => 4, 'active' => true, 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('site_id' => 2, 'domain_id' => 5, 'active' => true, 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('site_id' => 3, 'domain_id' => 6, 'active' => true, 'created' => '2001-02-03 00:01:02', 'updated' => '2007-03-17 01:22:31'),
<del> array('site_id' => 3, 'domain_id' => 7, 'active' => false, 'created' => '2001-02-03 00:01:02', 'updated' => '2007-03-17 01:22:31'),
<del> );
<del>}
<ide><path>tests/Fixture/ExteriorTypeCategoryFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class ExteriorTypeCategoryFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'image_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('image_id' => 1, 'name' => 'ExteriorTypeCategory 1')
<del> );
<del>}
<ide><path>tests/Fixture/FeatureSetFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class FeatureSetFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'FeatureSet 1')
<del> );
<del>}
<ide><path>tests/Fixture/FeaturedFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Short description for class.
<del> *
<del> */
<del>class FeaturedFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'article_featured_id' => ['type' => 'integer', 'null' => false],
<del> 'category_id' => ['type' => 'integer', 'null' => false],
<del> 'published_date' => 'datetime',
<del> 'end_date' => 'datetime',
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('article_featured_id' => 1, 'category_id' => 1, 'published_date' => '2007-03-31 10:39:23', 'end_date' => '2007-05-15 10:39:23', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('article_featured_id' => 2, 'category_id' => 1, 'published_date' => '2007-03-31 10:39:23', 'end_date' => '2007-05-15 10:39:23', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> );
<del>}
<ide><path>tests/Fixture/FilmFileFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class FilmFileFixture
<del> *
<del> */
<del>class FilmFileFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'length' => 255],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'name' => 'one'),
<del> array('id' => 2, 'name' => 'two')
<del> );
<del>}
<ide><path>tests/Fixture/FruitFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.7953
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Fruit Fixtures
<del> *
<del> */
<del>class FruitFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'string', 'length' => 36],
<del> 'name' => ['type' => 'string', 'length' => 255],
<del> 'color' => ['type' => 'string', 'length' => 13],
<del> 'shape' => ['type' => 'string', 'length' => 255],
<del> 'taste' => ['type' => 'string', 'length' => 255],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array(
<del> 'id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'name' => 'Orange',
<del> 'color' => 'orange', 'shape' => 'Spherical', 'taste' => 'Tangy & Sweet'
<del> )
<del> );
<del>}
<ide><path>tests/Fixture/FruitsUuidTagFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.7953
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class FruitsUuidTagFixture
<del> *
<del> */
<del>class FruitsUuidTagFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'fruit_id' => ['type' => 'uuid', 'null' => false],
<del> 'uuid_tag_id' => ['type' => 'uuid', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['uuid_tag_id']], 'unique_fruits_tags' => ['type' => 'unique', 'columns' => ['fruit_id', 'uuid_tag_id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('fruit_id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'uuid_tag_id' => '481fc6d0-b920-43e0-e50f-6d1740cf8569')
<del> );
<del>}
<ide><path>tests/Fixture/GroupUpdateAllFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class GroupUpdateAllFixture
<del> *
<del> */
<del>class GroupUpdateAllFixture extends TestFixture {
<del>
<del> public $table = 'group_update_all';
<del>
<del> public $fields = array(
<del> 'id' => ['type' => 'integer', 'null' => false, 'default' => null],
<del> 'name' => ['type' => 'string', 'null' => false, 'length' => 29],
<del> 'code' => ['type' => 'integer', 'null' => false, 'length' => 4],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']], 'PRIMARY' => ['type' => 'unique', 'columns' => 'id']]
<del> );
<del>
<del> public $records = array(
<del> array(
<del> 'id' => 1,
<del> 'name' => 'group one',
<del> 'code' => 120
<del> ),
<del> array(
<del> 'id' => 2,
<del> 'name' => 'group two',
<del> 'code' => 125
<del> ),
<del> array(
<del> 'id' => 3,
<del> 'name' => 'group three',
<del> 'code' => 130
<del> ),
<del> array(
<del> 'id' => 4,
<del> 'name' => 'group four',
<del> 'code' => 135
<del> ),
<del> );
<del>}
<ide><path>tests/Fixture/GuildFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class GuildFixture
<del> *
<del> */
<del>class GuildFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Warriors'),
<del> array('name' => 'Rangers'),
<del> array('name' => 'Wizards'),
<del> );
<del>}
<ide><path>tests/Fixture/GuildsPlayerFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class GuildsPlayerFixture
<del> *
<del> */
<del>class GuildsPlayerFixture extends TestFixture {
<del>
<del> public $useDbConfig = 'test2';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'player_id' => ['type' => 'integer', 'null' => false],
<del> 'guild_id' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('player_id' => 1, 'guild_id' => 1),
<del> array('player_id' => 1, 'guild_id' => 2),
<del> array('player_id' => 4, 'guild_id' => 3),
<del> );
<del>}
<ide><path>tests/Fixture/HomeFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class HomeFixture
<del> *
<del> */
<del>class HomeFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'another_article_id' => ['type' => 'integer', 'null' => false],
<del> 'advertisement_id' => ['type' => 'integer', 'null' => false],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('another_article_id' => 1, 'advertisement_id' => 1, 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('another_article_id' => 3, 'advertisement_id' => 1, 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')
<del> );
<del>}
<ide><path>tests/Fixture/ImageFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ImageFixture
<del> *
<del> */
<del>class ImageFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Image 1'),
<del> array('name' => 'Image 2'),
<del> array('name' => 'Image 3'),
<del> array('name' => 'Image 4'),
<del> array('name' => 'Image 5')
<del> );
<del>}
<ide><path>tests/Fixture/InnoFixture.php
<del><?php
<del>/**
<del> * Fixture to test be tested exclusively with InnoDB tables
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.2.0
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class InnoFixture
<del> *
<del> */
<del>class InnoFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
<del> '_options' => ['engine' => 'InnoDB']
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Name 1'),
<del> array('name' => 'Name 2'),
<del> );
<del>
<del>}
<ide><path>tests/Fixture/ItemFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ItemFixture
<del> *
<del> */
<del>class ItemFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'syfile_id' => ['type' => 'integer', 'null' => false],
<del> 'published' => ['type' => 'boolean', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('syfile_id' => 1, 'published' => 0, 'name' => 'Item 1'),
<del> array('syfile_id' => 2, 'published' => 0, 'name' => 'Item 2'),
<del> array('syfile_id' => 3, 'published' => 0, 'name' => 'Item 3'),
<del> array('syfile_id' => 4, 'published' => 0, 'name' => 'Item 4'),
<del> array('syfile_id' => 5, 'published' => 0, 'name' => 'Item 5'),
<del> array('syfile_id' => 6, 'published' => 0, 'name' => 'Item 6')
<del> );
<del>}
<ide><path>tests/Fixture/ItemsPortfolioFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ItemsPortfolioFixture
<del> *
<del> */
<del>class ItemsPortfolioFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'item_id' => ['type' => 'integer', 'null' => false],
<del> 'portfolio_id' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('item_id' => 1, 'portfolio_id' => 1),
<del> array('item_id' => 2, 'portfolio_id' => 2),
<del> array('item_id' => 3, 'portfolio_id' => 1),
<del> array('item_id' => 4, 'portfolio_id' => 1),
<del> array('item_id' => 5, 'portfolio_id' => 1),
<del> array('item_id' => 6, 'portfolio_id' => 2)
<del> );
<del>}
<ide><path>tests/Fixture/JoinABFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.6317
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinABFixture
<del> *
<del> */
<del>class JoinABFixture extends TestFixture {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'JoinAsJoinB'
<del> */
<del> public $name = 'JoinAsJoinB';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'join_a_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'join_b_id' => ['type' => 'integer', 'default' => null],
<del> 'other' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('join_a_id' => 1, 'join_b_id' => 2, 'other' => 'Data for Join A 1 Join B 2', 'created' => '2008-01-03 10:56:33', 'updated' => '2008-01-03 10:56:33'),
<del> array('join_a_id' => 2, 'join_b_id' => 3, 'other' => 'Data for Join A 2 Join B 3', 'created' => '2008-01-03 10:56:34', 'updated' => '2008-01-03 10:56:34'),
<del> array('join_a_id' => 3, 'join_b_id' => 1, 'other' => 'Data for Join A 3 Join B 1', 'created' => '2008-01-03 10:56:35', 'updated' => '2008-01-03 10:56:35')
<del> );
<del>}
<ide><path>tests/Fixture/JoinACFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.6317
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinACFixture
<del> *
<del> */
<del>class JoinACFixture extends TestFixture {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'JoinAsJoinC'
<del> */
<del> public $name = 'JoinAsJoinC';
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'join_a_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'join_c_id' => ['type' => 'integer', 'default' => null],
<del> 'other' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('join_a_id' => 1, 'join_c_id' => 2, 'other' => 'Data for Join A 1 Join C 2', 'created' => '2008-01-03 10:57:22', 'updated' => '2008-01-03 10:57:22'),
<del> array('join_a_id' => 2, 'join_c_id' => 3, 'other' => 'Data for Join A 2 Join C 3', 'created' => '2008-01-03 10:57:23', 'updated' => '2008-01-03 10:57:23'),
<del> array('join_a_id' => 3, 'join_c_id' => 1, 'other' => 'Data for Join A 3 Join C 1', 'created' => '2008-01-03 10:57:24', 'updated' => '2008-01-03 10:57:24')
<del> );
<del>}
<ide><path>tests/Fixture/JoinAFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.6317
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinAFixture
<del> *
<del> */
<del>class JoinAFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'default' => ''],
<del> 'body' => ['type' => 'text'],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Join A 1', 'body' => 'Join A 1 Body', 'created' => '2008-01-03 10:54:23', 'updated' => '2008-01-03 10:54:23'),
<del> array('name' => 'Join A 2', 'body' => 'Join A 2 Body', 'created' => '2008-01-03 10:54:24', 'updated' => '2008-01-03 10:54:24'),
<del> array('name' => 'Join A 3', 'body' => 'Join A 2 Body', 'created' => '2008-01-03 10:54:25', 'updated' => '2008-01-03 10:54:24')
<del> );
<del>}
<ide><path>tests/Fixture/JoinBFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.6317
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinBFixture
<del> *
<del> */
<del>class JoinBFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Join B 1', 'created' => '2008-01-03 10:55:01', 'updated' => '2008-01-03 10:55:01'),
<del> array('name' => 'Join B 2', 'created' => '2008-01-03 10:55:02', 'updated' => '2008-01-03 10:55:02'),
<del> array('name' => 'Join B 3', 'created' => '2008-01-03 10:55:03', 'updated' => '2008-01-03 10:55:03')
<del> );
<del>}
<ide><path>tests/Fixture/JoinCFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.6317
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinCFixture
<del> *
<del> */
<del>class JoinCFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Join C 1', 'created' => '2008-01-03 10:56:11', 'updated' => '2008-01-03 10:56:11'),
<del> array('name' => 'Join C 2', 'created' => '2008-01-03 10:56:12', 'updated' => '2008-01-03 10:56:12'),
<del> array('name' => 'Join C 3', 'created' => '2008-01-03 10:56:13', 'updated' => '2008-01-03 10:56:13')
<del> );
<del>}
<ide><path>tests/Fixture/JoinThingFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class JoinThingFixture
<del> *
<del> */
<del>class JoinThingFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'something_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'something_else_id' => ['type' => 'integer', 'default' => null],
<del> 'doomed' => ['type' => 'boolean', 'default' => false],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('something_id' => 1, 'something_else_id' => 2, 'doomed' => '1', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('something_id' => 2, 'something_else_id' => 3, 'doomed' => '0', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> array('something_id' => 3, 'something_else_id' => 1, 'doomed' => '1', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')
<del> );
<del>}
<ide><path>tests/Fixture/MessageFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MessageFixture
<del> *
<del> */
<del>class MessageFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'thread_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('thread_id' => 1, 'name' => 'Thread 1, Message 1'),
<del> array('thread_id' => 2, 'name' => 'Thread 2, Message 1'),
<del> array('thread_id' => 3, 'name' => 'Thread 3, Message 1')
<del> );
<del>}
<ide><path>tests/Fixture/MyCategoriesMyProductsFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MyCategoriesMyProductsFixture
<del> *
<del> */
<del>class MyCategoriesMyProductsFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'my_category_id' => ['type' => 'integer'],
<del> 'my_product_id' => ['type' => 'integer']
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('my_category_id' => 1, 'my_product_id' => 1),
<del> array('my_category_id' => 2, 'my_product_id' => 1),
<del> array('my_category_id' => 2, 'my_product_id' => 2),
<del> array('my_category_id' => 3, 'my_product_id' => 2),
<del> );
<del>}
<ide><path>tests/Fixture/MyCategoriesMyUsersFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MyCategoriesMyUsersFixture
<del> *
<del> */
<del>class MyCategoriesMyUsersFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'my_category_id' => ['type' => 'integer'],
<del> 'my_user_id' => ['type' => 'integer']
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('my_category_id' => 1, 'my_user_id' => 1),
<del> array('my_category_id' => 3, 'my_user_id' => 1),
<del> array('my_category_id' => 1, 'my_user_id' => 2),
<del> array('my_category_id' => 2, 'my_user_id' => 2),
<del> );
<del>}
<ide><path>tests/Fixture/MyCategoryFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MyCategoryFixture
<del> *
<del> */
<del>class MyCategoryFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'name' => 'A'),
<del> array('id' => 2, 'name' => 'B'),
<del> array('id' => 3, 'name' => 'C'),
<del> );
<del>}
<ide><path>tests/Fixture/MyProductFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MyProductFixture
<del> *
<del> */
<del>class MyProductFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'name' => 'book'),
<del> array('id' => 2, 'name' => 'computer'),
<del> );
<del>}
<ide><path>tests/Fixture/MyUserFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class MyUserFixture
<del> *
<del> */
<del>class MyUserFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'firstname' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'firstname' => 'userA'),
<del> array('id' => 2, 'firstname' => 'userB')
<del> );
<del>}
<ide><path>tests/Fixture/NodeFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://cakephp.org CakePHP(tm) Project
<del> * @since CakePHP(tm) v 1.2.0.6879 //Correct version number as needed**
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class NodeFixture
<del> *
<del> * @since CakePHP(tm) v 1.2.0.6879 //Correct version number as needed**
<del> */
<del>class NodeFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => 'string',
<del> 'state' => 'integer',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'name' => 'First', 'state' => 50),
<del> array('id' => 2, 'name' => 'Second', 'state' => 60),
<del> );
<del>}
<ide><path>tests/Fixture/NumericArticleFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class NumericArticleFixture
<del> *
<del> */
<del>class NumericArticleFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Article', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('title' => '12345abcde', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> );
<del>}
<ide><path>tests/Fixture/OverallFavoriteFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.7198
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class OverallFavoriteFixture
<del> *
<del> */
<del>class OverallFavoriteFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'model_type' => ['type' => 'string', 'length' => 255],
<del> 'model_id' => ['type' => 'integer'],
<del> 'priority' => ['type' => 'integer'],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('id' => 1, 'model_type' => 'Cd', 'model_id' => '1', 'priority' => '1'),
<del> array('id' => 2, 'model_type' => 'Book', 'model_id' => '1', 'priority' => '2')
<del> );
<del>}
<ide><path>tests/Fixture/PlayerFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class PlayerFixture
<del> *
<del> */
<del>class PlayerFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'mark', 'created' => '2007-03-17 01:16:23'),
<del> array('name' => 'jack', 'created' => '2007-03-17 01:18:23'),
<del> array('name' => 'larry', 'created' => '2007-03-17 01:20:23'),
<del> array('name' => 'jose', 'created' => '2007-03-17 01:22:23'),
<del> );
<del>}
<ide><path>tests/Fixture/PortfolioFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class PortfolioFixture
<del> *
<del> */
<del>class PortfolioFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'seller_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('seller_id' => 1, 'name' => 'Portfolio 1'),
<del> array('seller_id' => 1, 'name' => 'Portfolio 2'),
<del> array('seller_id' => 2, 'name' => 'Portfolio 1')
<del> );
<del>}
<ide><path>tests/Fixture/PrefixTestFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * PrefixTestFixture
<del> *
<del> */
<del>class PrefixTestFixture extends TestFixture {
<del>
<del> public $table = 'prefix_prefix_tests';
<del>
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>}
<ide><path>tests/Fixture/PrimaryModelFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class PrimaryModelFixture
<del> *
<del> */
<del>class PrimaryModelFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'primary_name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('primary_name' => 'Primary Name Existing')
<del> );
<del>}
<ide><path>tests/Fixture/ProductFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ProductFixture
<del> *
<del> */
<del>class ProductFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> 'type' => ['type' => 'string', 'length' => 255, 'null' => false],
<del> 'price' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Park\'s Great Hits', 'type' => 'Music', 'price' => 19),
<del> array('name' => 'Silly Puddy', 'type' => 'Toy', 'price' => 3),
<del> array('name' => 'Playstation', 'type' => 'Toy', 'price' => 89),
<del> array('name' => 'Men\'s T-Shirt', 'type' => 'Clothing', 'price' => 32),
<del> array('name' => 'Blouse', 'type' => 'Clothing', 'price' => 34),
<del> array('name' => 'Electronica 2002', 'type' => 'Music', 'price' => 4),
<del> array('name' => 'Country Tunes', 'type' => 'Music', 'price' => 21),
<del> array('name' => 'Watermelon', 'type' => 'Food', 'price' => 9)
<del> );
<del>}
<ide><path>tests/Fixture/ProductUpdateAllFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ProductUpdateAllFixture
<del> *
<del> */
<del>class ProductUpdateAllFixture extends TestFixture {
<del>
<del> public $table = 'product_update_all';
<del>
<del> public $fields = array(
<del> 'id' => ['type' => 'integer', 'null' => false, 'default' => null],
<del> 'name' => ['type' => 'string', 'null' => false, 'length' => 29],
<del> 'groupcode' => ['type' => 'integer', 'null' => false, 'length' => 4],
<del> 'group_id' => ['type' => 'integer', 'null' => false, 'length' => 8],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']], 'PRIMARY' => ['type' => 'unique', 'columns' => 'id']]
<del> );
<del>
<del> public $records = array(
<del> array(
<del> 'id' => 1,
<del> 'name' => 'product one',
<del> 'groupcode' => 120,
<del> 'group_id' => 1
<del> ),
<del> array(
<del> 'id' => 2,
<del> 'name' => 'product two',
<del> 'groupcode' => 120,
<del> 'group_id' => 1
<del> ),
<del> array(
<del> 'id' => 3,
<del> 'name' => 'product three',
<del> 'groupcode' => 125,
<del> 'group_id' => 2
<del> ),
<del> array(
<del> 'id' => 4,
<del> 'name' => 'product four',
<del> 'groupcode' => 135,
<del> 'group_id' => 4
<del> ),
<del> );
<del>}
<ide><path>tests/Fixture/ProjectFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ProjectFixture
<del> *
<del> */
<del>class ProjectFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'Project 1'),
<del> array('name' => 'Project 2'),
<del> array('name' => 'Project 3')
<del> );
<del>}
<ide><path>tests/Fixture/SampleFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SampleFixture
<del> *
<del> */
<del>class SampleFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'apple_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'length' => 40, 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('apple_id' => 3, 'name' => 'sample1'),
<del> array('apple_id' => 2, 'name' => 'sample2'),
<del> array('apple_id' => 4, 'name' => 'sample3'),
<del> array('apple_id' => 5, 'name' => 'sample4')
<del> );
<del>}
<ide><path>tests/Fixture/SecondaryModelFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SecondaryModelFixture
<del> *
<del> */
<del>class SecondaryModelFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'secondary_name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('secondary_name' => 'Secondary Name Existing')
<del> );
<del>}
<ide><path>tests/Fixture/SiteFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 2.1
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SiteFixture
<del> *
<del> */
<del>class SiteFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'created' => 'datetime',
<del> 'updated' => 'datetime',
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('name' => 'cakephp', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'),
<del> array('name' => 'Mark Story\'s sites', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'),
<del> array('name' => 'rchavik sites', 'created' => '2001-02-03 00:01:02', 'updated' => '2007-03-17 01:22:31'),
<del> );
<del>}
<ide><path>tests/Fixture/SomethingElseFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SomethingElseFixture
<del> *
<del> */
<del>class SomethingElseFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'default' => ''],
<del> 'body' => ['type' => 'text'],
<del> 'published' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Post', 'body' => 'First Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('title' => 'Second Post', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> array('title' => 'Third Post', 'body' => 'Third Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')
<del> );
<del>}
<ide><path>tests/Fixture/SomethingFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SomethingFixture
<del> *
<del> */
<del>class SomethingFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'default' => ''],
<del> 'body' => ['type' => 'text'],
<del> 'published' => ['type' => 'string', 'default' => ''],
<del> 'created' => ['type' => 'datetime', 'null' => true],
<del> 'updated' => ['type' => 'datetime', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Post', 'body' => 'First Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
<del> array('title' => 'Second Post', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
<del> array('title' => 'Third Post', 'body' => 'Third Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31')
<del> );
<del>}
<ide><path>tests/Fixture/StoriesTagFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class StoriesTagFixture
<del> *
<del> */
<del>class StoriesTagFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'story' => ['type' => 'integer', 'null' => false],
<del> 'tag_id' => ['type' => 'integer', 'null' => false],
<del> '_constraints' => ['UNIQUE_STORY_TAG' => ['type' => 'unique', 'columns' => ['story', 'tag_id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('story' => 1, 'tag_id' => 1)
<del> );
<del>}
<ide><path>tests/Fixture/StoryFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class StoryFixture
<del> *
<del> */
<del>class StoryFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'story' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['story']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('title' => 'First Story'),
<del> array('title' => 'Second Story')
<del> );
<del>}
<ide><path>tests/Fixture/SyfileFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class SyfileFixture
<del> *
<del> */
<del>class SyfileFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'image_id' => ['type' => 'integer', 'null' => true],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> 'item_count' => ['type' => 'integer', 'null' => true],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('image_id' => 1, 'name' => 'Syfile 1'),
<del> array('image_id' => 2, 'name' => 'Syfile 2'),
<del> array('image_id' => 5, 'name' => 'Syfile 3'),
<del> array('image_id' => 3, 'name' => 'Syfile 4'),
<del> array('image_id' => 4, 'name' => 'Syfile 5'),
<del> array('image_id' => null, 'name' => 'Syfile 6')
<del> );
<del>}
<ide><path>tests/Fixture/ThePaperMonkiesFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ThePaperMonkiesFixture
<del> *
<del> */
<del>class ThePaperMonkiesFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'apple_id' => ['type' => 'integer', 'length' => 10, 'null' => true],
<del> 'device_id' => ['type' => 'integer', 'length' => 10, 'null' => true]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array();
<del>}
<ide><path>tests/Fixture/ThreadFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * Class ThreadFixture
<del> *
<del> */
<del>class ThreadFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'project_id' => ['type' => 'integer', 'null' => false],
<del> 'name' => ['type' => 'string', 'null' => false],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('project_id' => 1, 'name' => 'Project 1, Thread 1'),
<del> array('project_id' => 1, 'name' => 'Project 1, Thread 2'),
<del> array('project_id' => 2, 'name' => 'Project 2, Thread 1')
<del> );
<del>}
<ide><path>tests/Fixture/UnderscoreFieldFixture.php
<del><?php
<del>/**
<del> * Short description for file.
<del> *
<del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
<del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
<del> * @since CakePHP(tm) v 1.2.0.4667
<del> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\Fixture;
<del>
<del>use Cake\TestSuite\Fixture\TestFixture;
<del>
<del>/**
<del> * UnderscoreFieldFixture class
<del> *
<del> */
<del>class UnderscoreFieldFixture extends TestFixture {
<del>
<del>/**
<del> * fields property
<del> *
<del> * @var array
<del> */
<del> public $fields = array(
<del> 'id' => ['type' => 'integer'],
<del> 'user_id' => ['type' => 'integer', 'null' => false],
<del> 'my_model_has_a_field' => ['type' => 'string', 'null' => false],
<del> 'body_field' => 'text',
<del> 'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'],
<del> 'another_field' => ['type' => 'integer', 'length' => 3],
<del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<del> );
<del>
<del>/**
<del> * records property
<del> *
<del> * @var array
<del> */
<del> public $records = array(
<del> array('user_id' => 1, 'my_model_has_a_field' => 'First Article', 'body_field' => 'First Article Body', 'published' => 'Y', 'another_field' => 2),
<del> array('user_id' => 3, 'my_model_has_a_field' => 'Second Article', 'body_field' => 'Second Article Body', 'published' => 'Y', 'another_field' => 3),
<del> array('user_id' => 1, 'my_model_has_a_field' => 'Third Article', 'body_field' => 'Third Article Body', 'published' => 'Y', 'another_field' => 5),
<del> );
<del>
<del>} | 84 |
Javascript | Javascript | avoid tostring conversion in lookup | 6dc697071e430631aeaba348245168fca1c56164 | <ide><path>fonts.js
<ide> var Fonts = {
<ide> for (var i = 0; i < chars.length; ++i) {
<ide> var ch = chars.charCodeAt(i);
<ide> var uc = encoding[ch];
<del> if (typeof uc != "number") // we didn't convert the glyph yet
<del> uc = encoding[ch] = GlyphsUnicode[uc];
<add> if (uc instanceof Name) // we didn't convert the glyph yet
<add> uc = encoding[ch] = GlyphsUnicode[uc.name];
<ide> ret += String.fromCharCode(uc);
<ide> }
<ide> | 1 |
Go | Go | add rm-gocheck.go script and eg templates | 8f64611c83fcd66aa99ddf5a4fa1d0b5ce0ddef1 | <ide><path>rm-gocheck.go
<add>// +build ignore
<add>
<add>package main
<add>
<add>import (
<add> "bufio"
<add> "bytes"
<add> "errors"
<add> "flag"
<add> "fmt"
<add> "go/format"
<add> "io/ioutil"
<add> "os"
<add> "os/exec"
<add> "path/filepath"
<add> "regexp"
<add> "strings"
<add> "sync"
<add>)
<add>
<add>var (
<add> shouldCommit = flag.Bool("commit", false, "if set, each step will result in a commit")
<add> filter = flag.String("filter", "", "only run on files matching filter")
<add> titlePrefix = flag.String("prefix", "rm-gocheck: ", "commit title prefix")
<add> allFiles []string
<add> fileToCmp = map[string]string{}
<add> cmps = map[string][]string{}
<add>)
<add>
<add>type action func(*step) string
<add>
<add>type step struct {
<add> files []string
<add> pkgs map[string]string
<add>
<add> title string
<add> pattern string
<add> action action
<add> comment string
<add>}
<add>
<add>func mustSh(format string, args ...interface{}) (output []string) {
<add> var err error
<add> output, err = sh(format, args...)
<add> if err != nil {
<add> panic(err)
<add> }
<add> return
<add>}
<add>
<add>func sh(format string, args ...interface{}) (output []string, err error) {
<add> cmdargs := fmt.Sprintf(format, args...)
<add> out, err := exec.Command("sh", "-c", cmdargs).CombinedOutput()
<add> if err != nil {
<add> return nil, fmt.Errorf("cmd=%s\nout=%s\n", cmdargs, out)
<add> }
<add> l := strings.Split(string(out), "\n")
<add> // remove last element if empty
<add> if len(l[len(l)-1]) == 0 {
<add> l = l[:len(l)-1]
<add> }
<add> return l, nil
<add>}
<add>
<add>func listToArgs(l []string) string {
<add> s := fmt.Sprintf("%q", l)
<add> s = s[1 : len(s)-1]
<add> return s
<add>}
<add>
<add>func Replace(subst string) action {
<add> return func(s *step) string {
<add> return fmt.Sprintf("sed -E -i 's#%s#%s#g' \\\n-- %s", s.pattern, subst, listToArgs(s.files))
<add> }
<add>}
<add>
<add>func CmpReplace(subst string) action {
<add> return func(s *step) string {
<add> var allCmdArgs, filesNeedingCmpImport []string
<add> for _, file := range s.files {
<add> cmp, ok := fileToCmp[file]
<add> if !ok {
<add> cmp = "cmp"
<add> l := mustSh(`grep -m 1 -F '"gotest.tools/assert/cmp"' %s | awk '{print $1}'`, file)
<add> if len(l) > 0 {
<add> cmp = l[0]
<add> } else {
<add> filesNeedingCmpImport = append(filesNeedingCmpImport, file)
<add> }
<add> fileToCmp[file] = cmp
<add> cmps[cmp] = append(cmps[cmp], file)
<add> }
<add> }
<add>
<add> if len(filesNeedingCmpImport) > 0 {
<add> linesep := " \\\n"
<add> importCmd := fmt.Sprintf(`sed -E -i '0,/^import "github\.com/ s/^(import "github\.com.*)/\1\nimport "gotest.tools\/assert\/cmp")/'%s-- %s`, linesep, listToArgs(filesNeedingCmpImport))
<add> allCmdArgs = append(allCmdArgs, importCmd)
<add> importCmd = fmt.Sprintf(`sed -E -i '0,/^\t+"github\.com/ s/(^\t+"github\.com.*)/\1\n"gotest.tools\/assert\/cmp"/'%s-- %s`, linesep, listToArgs(filesNeedingCmpImport))
<add> allCmdArgs = append(allCmdArgs, importCmd)
<add> }
<add>
<add> for cmp, files := range cmps {
<add> cmdargs := fmt.Sprintf("sed -E -i 's#%s#%s#g' \\\n-- %s", s.pattern, strings.ReplaceAll(subst, "${cmp}", cmp), listToArgs(files))
<add> allCmdArgs = append(allCmdArgs, cmdargs)
<add> }
<add> return strings.Join(allCmdArgs, " \\\n&& \\\n")
<add> }
<add>}
<add>
<add>func redress(pattern string, files ...string) error {
<add> rgx, err := regexp.Compile(pattern)
<add> if err != nil {
<add> return err
<add> }
<add> if len(files) == 0 {
<add> return errors.New("no files provided")
<add> }
<add> fn := func(file string) error {
<add> f, err := os.Open(file)
<add> if err != nil {
<add> return err
<add> }
<add> defer f.Close()
<add>
<add> tmpName := file + ".tmp"
<add> fixed, err := os.Create(tmpName)
<add> if err != nil {
<add> return err
<add> }
<add> defer fixed.Close()
<add>
<add> const (
<add> searching = iota
<add> found
<add> line_done
<add> )
<add> state := searching
<add> s := bufio.NewScanner(f)
<add> for s.Scan() {
<add> b := s.Bytes()
<add> if state != found {
<add> bb := bytes.TrimRight(b, " \t")
<add> if state == line_done && len(bb) == 0 {
<add> continue
<add> }
<add> state = searching
<add> if !rgx.Match(b) {
<add> fixed.Write(b)
<add> fixed.Write([]byte{'\n'})
<add> } else {
<add> fixed.Write(bb)
<add> fixed.Write([]byte{' '})
<add> state = found
<add> }
<add> continue
<add> }
<add> b = bytes.TrimRight(b, " \t")
<add> fixed.Write(b)
<add> if len(b) > 0 {
<add> switch b[len(b)-1] {
<add> case ',', '(':
<add> fixed.Write([]byte{' '})
<add> continue
<add> case ')':
<add> fixed.Write([]byte{'\n'})
<add> state = line_done
<add> }
<add> }
<add> }
<add> if err := s.Err(); err != nil {
<add> return err
<add> }
<add>
<add> fixed.Close()
<add> f.Close()
<add> src, err := ioutil.ReadFile(tmpName)
<add> if err != nil {
<add> return err
<add> }
<add> src, err = format.Source(src)
<add> if err != nil {
<add> return err
<add> }
<add> os.Remove(tmpName)
<add> return ioutil.WriteFile(file, src, 0644)
<add> }
<add>
<add> var wg sync.WaitGroup
<add> wg.Add(len(files))
<add> for _, file := range files {
<add> go func(file string) {
<add> defer wg.Done()
<add> if err := fn(file); err != nil {
<add> panic(fmt.Sprintf("redress %s: %v", file, err))
<add> }
<add> }(file)
<add> }
<add> wg.Wait()
<add> return nil
<add>}
<add>
<add>func Redress(s *step) string {
<add> return fmt.Sprintf("go run rm-gocheck.go redress '%s' \\\n %s", s.pattern, listToArgs(s.files))
<add>}
<add>
<add>func Format(s *step) string {
<add> pkgs := make([]string, 0, len(s.pkgs))
<add> for dir := range s.pkgs {
<add> pkgs = append(pkgs, "./"+dir)
<add> }
<add> files := listToArgs(pkgs)
<add> return fmt.Sprintf("goimports -w \\\n-- %s \\\n&& \\\n gofmt -w -s \\\n-- %s", files, files)
<add>}
<add>
<add>func CommentInterface(s *step) string {
<add> cmds := make([]string, 0, len(s.pkgs))
<add> for dir := range s.pkgs {
<add> cmd := fmt.Sprintf(`while :; do \
<add> out=$(go test -c ./%s 2>&1 | grep 'cannot use nil as type string in return argument') || break
<add> echo "$out" | while read line; do
<add> file=$(echo "$line" | cut -d: -f1)
<add> n=$(echo "$line" | cut -d: -f2)
<add> sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
<add> done
<add>done`, dir)
<add> cmds = append(cmds, cmd)
<add> }
<add> return strings.Join(cmds, " \\\n&& \\\n")
<add>}
<add>
<add>func Eg(template string, prehook action, helperTypes string) action {
<add> return func(s *step) string {
<add> cmds := make([]string, 0, 3+4*len(s.pkgs))
<add>
<add> if prehook != nil {
<add> cmds = append(cmds, prehook(s))
<add> }
<add>
<add> cmdstr := fmt.Sprintf(`go get -d golang.org/x/tools/cmd/eg && dir=$(go env GOPATH)/src/golang.org/x/tools && git -C "$dir" fetch https://github.com/tiborvass/tools handle-variadic && git -C "$dir" checkout 61a94b82347c29b3289e83190aa3dda74d47abbb && go install golang.org/x/tools/cmd/eg`)
<add> cmds = append(cmds, cmdstr)
<add>
<add> for dir, pkg := range s.pkgs {
<add> cmds = append(cmds, fmt.Sprintf(`/bin/echo -e 'package %s\n%s' > ./%s/eg_helper.go`, pkg, helperTypes, dir))
<add> cmds = append(cmds, fmt.Sprintf(`goimports -w ./%s`, dir))
<add> cmds = append(cmds, fmt.Sprintf(`eg -w -t %s -- ./%s`, template, dir))
<add> cmds = append(cmds, fmt.Sprintf(`rm -f ./%s/eg_helper.go`, dir))
<add> }
<add> cmds = append(cmds, fmt.Sprintf("go run rm-gocheck.go redress '%s' \\\n %s", `\bassert\.Assert\b.*(\(|,)\s*$`, listToArgs(s.files)))
<add> return strings.Join(cmds, " \\\n&& \\\n")
<add> }
<add>}
<add>
<add>func do(steps []step) {
<add> fileArgs := listToArgs(allFiles)
<add> for _, s := range steps {
<add> fmt.Print(s.title, "... ")
<add> s.files, _ = sh(`git grep --name-only -E '%s' -- %s`, s.pattern, fileArgs)
<add> if len(s.files) == 0 {
<add> fmt.Println("no files match")
<add> continue
<add> }
<add> s.pkgs = map[string]string{}
<add> pkg := ""
<add> if len(s.files) > 0 {
<add> x := mustSh(`grep -m1 '^package ' -- %s | cut -d' ' -f2`, s.files[0])
<add> pkg = x[0]
<add> }
<add> for _, file := range s.files {
<add> s.pkgs[filepath.Dir(file)] = pkg
<add> }
<add> cmdstr := s.action(&s)
<add> mustSh(cmdstr)
<add> if *shouldCommit {
<add> if len(s.comment) > 0 {
<add> s.comment = "\n\n" + s.comment
<add> }
<add> msg := fmt.Sprintf("%s%s\n\n%s%s", *titlePrefix, s.title, cmdstr, s.comment)
<add> sh(`git add %s`, listToArgs(s.files))
<add> cmd := exec.Command("git", "commit", "-s", "-F-")
<add> cmd.Stdin = strings.NewReader(msg)
<add> out, err := cmd.CombinedOutput()
<add> if err != nil {
<add> panic(string(out))
<add> }
<add> fmt.Println("committed")
<add> } else {
<add> fmt.Println("done")
<add> }
<add> }
<add>}
<add>
<add>func main() {
<add> flag.Parse()
<add>
<add> args := flag.Args()
<add> if len(args) > 0 {
<add> switch cmd := args[0]; cmd {
<add> case "redress":
<add> if len(args) < 3 {
<add> panic(fmt.Sprintf("usage: %s [flags] redress <pattern> <files...>", os.Args[0]))
<add> }
<add> if err := redress(args[1], args[2:]...); err != nil {
<add> panic(fmt.Sprintf("redress: %v", err))
<add> }
<add> return
<add> default:
<add> panic(fmt.Sprintf("unknown command %s", cmd))
<add> }
<add> }
<add>
<add> allFiles, _ = sh(`git grep --name-only '"github.com/go-check/check"' :**.go | grep -vE '^(vendor/|integration-cli/checker|rm-gocheck\.go|template\..*\.go)' | grep -E '%s'`, *filter)
<add> if len(allFiles) == 0 {
<add> return
<add> }
<add>
<add> do([]step{
<add> {
<add> title: "normalize c.Check to c.Assert",
<add> pattern: `\bc\.Check\(`,
<add> action: Replace(`c.Assert(`),
<add> },
<add> {
<add> title: "redress multiline c.Assert calls",
<add> pattern: `\bc\.Assert\b.*(,|\()\s*$`,
<add> action: Redress,
<add> },
<add> {
<add> title: "c.Assert(...) -> assert.Assert(c, ...)",
<add> pattern: `\bc\.Assert\(`,
<add> action: Replace(`assert.Assert(c, `),
<add> },
<add> {
<add> title: "check.C -> testing.B for BenchmarkXXX",
<add> pattern: `( Benchmark[^\(]+\([^ ]+ \*)check\.C\b`,
<add> action: Replace(`\1testing.B`),
<add> },
<add> {
<add> title: "check.C -> testing.T",
<add> pattern: `\bcheck\.C\b`,
<add> action: Replace(`testing.T`),
<add> },
<add> {
<add> title: "ErrorMatches -> assert.ErrorContains",
<add> pattern: `\bassert\.Assert\(c, (.*), check\.ErrorMatches,`,
<add> action: Replace(`assert.ErrorContains(c, \1,`),
<add> },
<add> {
<add> title: "normalize to use checker",
<add> pattern: `\bcheck\.(Equals|DeepEquals|HasLen|IsNil|Matches|Not|NotNil)\b`,
<add> action: Replace(`checker.\1`),
<add> },
<add> {
<add> title: "Not(IsNil) -> != nil",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Not\(checker\.IsNil\)`,
<add> action: Replace(`assert.Assert(c, \1 != nil`),
<add> },
<add> {
<add> title: "Not(Equals) -> a != b",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Equals\), (.*)`,
<add> action: Replace(`assert.Assert(c, \1 != \2`),
<add> },
<add> {
<add> title: "Not(Matches) -> !cmp.Regexp",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Matches\), (.*)\)`,
<add> action: CmpReplace(`assert.Assert(c, !${cmp}.Regexp("^"+\2+"$", \1)().Success())`),
<add> },
<add> {
<add> title: "Equals -> assert.Equal",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Equals, (.*)`,
<add> action: Replace(`assert.Equal(c, \1, \2`),
<add> },
<add> {
<add> title: "DeepEquals -> assert.DeepEqual",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.DeepEquals, (.*)`,
<add> action: Replace(`assert.DeepEqual(c, \1, \2`),
<add> },
<add> {
<add> title: "HasLen -> assert.Equal + len()",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.HasLen, (.*)`,
<add> action: Replace(`assert.Equal(c, len(\1), \2`),
<add> },
<add> {
<add> title: "IsNil",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.IsNil\b`,
<add> action: Replace(`assert.Assert(c, \1 == nil`),
<add> },
<add> {
<add> title: "NotNil",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.NotNil\b`,
<add> action: Replace(`assert.Assert(c, \1 != nil`),
<add> },
<add> {
<add> title: "False",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.False\b`,
<add> action: Replace(`assert.Assert(c, !\1`),
<add> },
<add> {
<add> title: "True",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.True`,
<add> action: Replace(`assert.Assert(c, \1`),
<add> },
<add> {
<add> title: "redress check.Suite calls",
<add> pattern: `[^/]\bcheck\.Suite\(.*\{\s*$`,
<add> action: Redress,
<add> },
<add> {
<add> title: "comment out check.Suite calls",
<add> pattern: `^([^*])+?((var .*)?check\.Suite\(.*\))`,
<add> action: Replace(`\1/*\2*/`),
<add> },
<add> {
<add> title: "comment out check.TestingT",
<add> pattern: `([^*])(check\.TestingT\([^\)]+\))`,
<add> action: Replace(`\1/*\2*/`),
<add> },
<add> {
<add> title: "run goimports to compile successfully",
<add> action: Format,
<add> },
<add> {
<add> title: "Matches -> cmp.Regexp",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Matches, (.*)\)$`,
<add> action: Eg("template.matches.go",
<add> CmpReplace(`assert.Assert(c, eg_matches(${cmp}.Regexp, \1, \2))`),
<add> `var eg_matches func(func(cmp.RegexOrPattern, string) cmp.Comparison, interface{}, string, ...interface{}) bool`),
<add> },
<add> {
<add> title: "Not(Contains) -> !strings.Contains",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Contains\), (.*)\)$`,
<add> action: Eg("template.not_contains.go",
<add> Replace(`assert.Assert(c, !eg_contains(\1, \2))`),
<add> `var eg_contains func(arg1, arg2 string, extra ...interface{}) bool`),
<add> },
<add> {
<add> title: "Contains -> strings.Contains",
<add> pattern: `\bassert\.Assert\(c, (.*), checker\.Contains, (.*)\)$`,
<add> action: Eg("template.contains.go",
<add> Replace(`assert.Assert(c, eg_contains(\1, \2))`),
<add> `var eg_contains func(arg1, arg2 string, extra ...interface{}) bool`),
<add> },
<add> {
<add> title: "convert check.Commentf to string - with multiple args",
<add> pattern: `\bcheck.Commentf\(([^,]+),(.*)\)`,
<add> action: Replace(`fmt.Sprintf(\1,\2)`),
<add> },
<add> {
<add> title: "convert check.Commentf to string - with just one string",
<add> pattern: `\bcheck.Commentf\(("[^"]+")\)`,
<add> action: Replace(`\1`),
<add> },
<add> {
<add> title: "convert check.Commentf to string - other",
<add> pattern: `\bcheck.Commentf\(([^\)]+)\)`,
<add> action: Replace(`\1`),
<add> },
<add> {
<add> title: "check.CommentInterface -> string",
<add> pattern: `(\*testing\.T\b.*)check\.CommentInterface\b`,
<add> action: Replace(`\1string`),
<add> },
<add> {
<add> title: "goimports",
<add> action: Format,
<add> },
<add> {
<add> title: "fix compile errors from converting check.CommentInterface to string",
<add> action: CommentInterface,
<add> },
<add> })
<add>}
<ide><path>template.contains.go
<add>// +build ignore
<add>
<add>package main
<add>
<add>import (
<add> "strings"
<add> "testing"
<add>
<add> "gotest.tools/assert"
<add>)
<add>
<add>type fn func(arg1, arg2 string, extra ...interface{}) bool
<add>type assertfn func(t assert.TestingT, comparison assert.BoolOrComparison, msgAndArgs ...interface{})
<add>
<add>func before(
<add> t *testing.T,
<add> a assertfn,
<add> eg_contains fn,
<add> arg1 string,
<add> arg2 string,
<add> extra ...interface{}) {
<add>
<add> a(t, eg_contains(arg1, arg2, extra...))
<add>}
<add>
<add>func after(
<add> t *testing.T,
<add> a assertfn,
<add> eg_contains fn,
<add> arg1 string,
<add> arg2 string,
<add> extra ...interface{}) {
<add>
<add> a(t, strings.Contains(arg1, arg2), extra...)
<add>}
<ide><path>template.matches.go
<add>// +build ignore
<add>
<add>package main
<add>
<add>import (
<add> "testing"
<add>
<add> "gotest.tools/assert"
<add> "gotest.tools/assert/cmp"
<add>)
<add>
<add>type fn func(re func(cmp.RegexOrPattern, string) cmp.Comparison, r interface{}, v string, extra ...interface{}) bool
<add>type assertfn func(t assert.TestingT, comparison assert.BoolOrComparison, msgAndArgs ...interface{})
<add>
<add>func before(
<add> t *testing.T,
<add> a assertfn,
<add> eg_matches fn,
<add> re func(cmp.RegexOrPattern, string) cmp.Comparison,
<add> r string,
<add> v string,
<add> extra ...interface{}) {
<add>
<add> a(t, eg_matches(re, v, r, extra...))
<add>}
<add>
<add>func after(
<add> t *testing.T,
<add> a assertfn,
<add> eg_matches fn,
<add> re func(cmp.RegexOrPattern, string) cmp.Comparison,
<add> r string,
<add> v string,
<add> extra ...interface{}) {
<add>
<add> a(t, re("^"+r+"$", v), extra...)
<add>}
<ide><path>template.not_contains.go
<add>// +build ignore
<add>
<add>package main
<add>
<add>import (
<add> "strings"
<add> "testing"
<add>
<add> "gotest.tools/assert"
<add>)
<add>
<add>type fn func(arg1, arg2 string, extra ...interface{}) bool
<add>type assertfn func(t assert.TestingT, comparison assert.BoolOrComparison, msgAndArgs ...interface{})
<add>
<add>func before(
<add> t *testing.T,
<add> a assertfn,
<add> eg_contains fn,
<add> arg1 string,
<add> arg2 string,
<add> extra ...interface{}) {
<add>
<add> a(t, !eg_contains(arg1, arg2, extra...))
<add>}
<add>
<add>func after(
<add> t *testing.T,
<add> a assertfn,
<add> eg_contains fn,
<add> arg1 string,
<add> arg2 string,
<add> extra ...interface{}) {
<add>
<add> a(t, !strings.Contains(arg1, arg2), extra...)
<add>} | 4 |
Python | Python | remove print statements from test | 51eb190ef491743b788f940ff724a308d64675ba | <ide><path>spacy/tests/doc/test_doc_api.py
<ide> def test_doc_api_runtime_error(en_tokenizer):
<ide> if len(np) > 1:
<ide> nps.append((np.start_char, np.end_char, np.root.tag_, np.text, np.root.ent_type_))
<ide> for np in nps:
<del> print(np)
<del> for word in doc:
<del> print(word.idx, word.text, word.head.i, word.head.text)
<ide> doc.merge(*np)
<ide>
<ide> | 1 |
Python | Python | fix main failure after moto upgrade | f3f07574a61482fc9ca20e54fba594d3ceae72ef | <ide><path>setup.py
<ide> def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version
<ide> 'jira',
<ide> 'jsondiff',
<ide> 'mongomock',
<del> 'moto[glue]>=3.1.0',
<add> 'moto[glue]>=3.1.6',
<ide> 'parameterized',
<ide> 'paramiko',
<ide> 'pipdeptree',
<ide><path>tests/providers/amazon/aws/log/test_cloudwatch_task_handler.py
<ide> def setUp(self):
<ide> ':', '_'
<ide> )
<ide>
<del> moto.core.moto_api_backend.reset()
<add> moto.moto_api._internal.models.moto_api_backend.reset()
<ide> self.conn = boto3.client('logs', region_name=self.region_name)
<ide>
<ide> def tearDown(self):
<ide><path>tests/providers/amazon/aws/log/test_s3_task_handler.py
<ide> def setUp(self):
<ide> self.conn = boto3.client('s3')
<ide> # We need to create the bucket since this is all in Moto's 'virtual'
<ide> # AWS account
<del> moto.core.moto_api_backend.reset()
<add> moto.moto_api._internal.models.moto_api_backend.reset()
<ide> self.conn.create_bucket(Bucket="bucket")
<ide>
<ide> def tearDown(self): | 3 |
Javascript | Javascript | handle newline characters inside special tags | cc8755cda6efda0b52954388e8a8d5306e4bfbca | <ide><path>src/ngSanitize/sanitize.js
<ide> function htmlParser(html, handler) {
<ide> }
<ide>
<ide> } else {
<del> html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
<add> html = html.replace(new RegExp("([^]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
<ide> function(all, text) {
<ide> text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
<ide>
<ide><path>test/ngSanitize/sanitizeSpec.js
<ide> describe('HTML', function() {
<ide> expectHTML('a<SCRIPT>evil< / scrIpt >c.').toEqual('ac.');
<ide> });
<ide>
<add> it('should remove script that has newline characters', function() {
<add> expectHTML('a<SCRIPT\n>\n\revil\n\r< / scrIpt\n >c.').toEqual('ac.');
<add> });
<add>
<ide> it('should remove DOCTYPE header', function() {
<ide> expectHTML('<!DOCTYPE html>').toEqual('');
<ide> expectHTML('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n"http://www.w3.org/TR/html4/strict.dtd">').toEqual('');
<ide> describe('HTML', function() {
<ide> expectHTML('a<STyle>evil</stYle>c.').toEqual('ac.');
<ide> });
<ide>
<add> it('should remove style that has newline characters', function() {
<add> expectHTML('a<STyle \n>\n\revil\n\r</stYle\n>c.').toEqual('ac.');
<add> });
<add>
<ide> it('should remove script and style', function() {
<ide> expectHTML('a<STyle>evil<script></script></stYle>c.').toEqual('ac.');
<ide> }); | 2 |
Text | Text | add note for loading env files during testing | 62967fc667cef919e6af059dc906a62828f10f6f | <ide><path>docs/basic-features/environment-variables.md
<ide> This one is useful when running tests with tools like `jest` or `cypress` where
<ide> There is a small difference between `test` environment, and both `development` and `production` that you need to bear in mind: `.env.local` won't be loaded, as you expect tests to produce the same results for everyone. This way every test execution will use same env defaults across different executions by ignoring your `.env.local` (which is intended to override the default set).
<ide>
<ide> > **Note**: similar to Default Environment Variables, `.env.test` file should be included in your repository, but `.env.test.local` shouldn't, as `.env*.local` are intended to be ignored through `.gitignore`.
<add>
<add>While running unit tests you can make sure to load your environment variables the same way Next.js does by leveraging the `loadEnvConfig` function from the `@next/env` package.
<add>
<add>```js
<add>// The below can be used in a Jest global setup file or similar for your testing set-up
<add>import { loadEnvConfig } from '@next/env'
<add>
<add>export default async () => {
<add> const projectDir = process.cwd()
<add> loadEnvConfig(projectDir)
<add>}
<add>``` | 1 |
Javascript | Javascript | improve assertion message in test-dns-any | 84836df1503467e53e22bdc0723897acc5d756c4 | <ide><path>test/internet/test-dns-any.js
<ide> TEST(async function test_google(done) {
<ide> function validateResult(res) {
<ide> const types = processResult(res);
<ide> assert.ok(
<del> types.A && types.AAAA && types.MX &&
<del> types.NS && types.TXT && types.SOA);
<add> types.A && types.AAAA && types.MX && types.NS && types.TXT && types.SOA,
<add> `Missing record type, found ${Object.keys(types)}`);
<ide> }
<ide>
<ide> validateResult(await dnsPromises.resolve('google.com', 'ANY'));
<ide> TEST(async function test_google(done) {
<ide> TEST(async function test_sip2sip_for_naptr(done) {
<ide> function validateResult(res) {
<ide> const types = processResult(res);
<del> assert.ok(types.A && types.NS && types.NAPTR && types.SOA);
<add> assert.ok(types.A && types.NS && types.NAPTR && types.SOA,
<add> `Missing record type, found ${Object.keys(types)}`);
<ide> }
<ide>
<ide> validateResult(await dnsPromises.resolve('sip2sip.info', 'ANY')); | 1 |
Ruby | Ruby | use h1 for titles | 3ec7b1cba359457cc232db456e460de6a92d7079 | <ide><path>actionpack/lib/action_dispatch/routing.rb
<ide> require 'action_controller/polymorphic_routes'
<ide>
<ide> module ActionDispatch
<del> # == Routing
<add> # = Routing
<ide> #
<ide> # The routing module provides URL rewriting in native Ruby. It's a way to
<ide> # redirect incoming requests to controllers and actions. This replaces | 1 |
Javascript | Javascript | add brackets for multiline if/for statements | 2a9452e51b38b86503ba30a76c65f906b3f99728 | <ide><path>lib/AmdMainTemplatePlugin.js
<ide> class AmdMainTemplatePlugin {
<ide> }
<ide>
<ide> mainTemplate.hooks.globalHashPaths.tap("AmdMainTemplatePlugin", paths => {
<del> if (this.name) paths.push(this.name);
<add> if (this.name) {
<add> paths.push(this.name);
<add> }
<ide> return paths;
<ide> });
<ide>
<ide><path>lib/BannerPlugin.js
<ide> const validateOptions = require("schema-utils");
<ide> const schema = require("../schemas/plugins/BannerPlugin.json");
<ide>
<ide> const wrapComment = str => {
<del> if (!str.includes("\n")) return Template.toComment(str);
<add> if (!str.includes("\n")) {
<add> return Template.toComment(str);
<add> }
<ide> return `/*!\n * ${str
<ide> .replace(/\*\//g, "* /")
<ide> .split("\n")
<ide><path>lib/BasicEvaluatedExpression.js
<ide> class BasicEvaluatedExpression {
<ide>
<ide> asBool() {
<ide> if (this.truthy) return true;
<del> else if (this.falsy) return false;
<del> else if (this.isBoolean()) return this.bool;
<del> else if (this.isNull()) return false;
<del> else if (this.isString()) return this.string !== "";
<del> else if (this.isNumber()) return this.number !== 0;
<del> else if (this.isRegExp()) return true;
<del> else if (this.isArray()) return true;
<del> else if (this.isConstArray()) return true;
<del> else if (this.isWrapped())
<add> if (this.falsy) return false;
<add> if (this.isBoolean()) return this.bool;
<add> if (this.isNull()) return false;
<add> if (this.isString()) return this.string !== "";
<add> if (this.isNumber()) return this.number !== 0;
<add> if (this.isRegExp()) return true;
<add> if (this.isArray()) return true;
<add> if (this.isConstArray()) return true;
<add> if (this.isWrapped()) {
<ide> return (this.prefix && this.prefix.asBool()) ||
<ide> (this.postfix && this.postfix.asBool())
<ide> ? true
<ide> : undefined;
<del> else if (this.isTemplateString()) {
<add> }
<add> if (this.isTemplateString()) {
<ide> for (const quasi of this.quasis) {
<ide> if (quasi.asBool()) return true;
<ide> }
<ide> class BasicEvaluatedExpression {
<ide> this.type = TypeConditional;
<ide> this.options = [];
<ide> }
<del> for (const item of options) this.options.push(item);
<add> for (const item of options) {
<add> this.options.push(item);
<add> }
<ide> return this;
<ide> }
<ide>
<ide><path>lib/CachePlugin.js
<ide> class CachePlugin {
<ide> (childCompiler, compilerName, compilerIndex) => {
<ide> if (cache) {
<ide> let childCache;
<del> if (!cache.children) cache.children = {};
<del> if (!cache.children[compilerName])
<add> if (!cache.children) {
<add> cache.children = {};
<add> }
<add> if (!cache.children[compilerName]) {
<ide> cache.children[compilerName] = [];
<del> if (cache.children[compilerName][compilerIndex])
<add> }
<add> if (cache.children[compilerName][compilerIndex]) {
<ide> childCache = cache.children[compilerName][compilerIndex];
<del> else cache.children[compilerName].push((childCache = {}));
<add> } else {
<add> cache.children[compilerName].push((childCache = {}));
<add> }
<ide> registerCacheToCompiler(childCompiler, childCache);
<ide> }
<ide> }
<ide> class CachePlugin {
<ide> this.watching = true;
<ide> });
<ide> compiler.hooks.run.tapAsync("CachePlugin", (compiler, callback) => {
<del> if (!compiler._lastCompilationFileDependencies) return callback();
<add> if (!compiler._lastCompilationFileDependencies) {
<add> return callback();
<add> }
<ide> const fs = compiler.inputFileSystem;
<ide> const fileTs = (compiler.fileTimestamps = new Map());
<ide> asyncLib.forEach(
<ide><path>lib/Chunk.js
<ide> class Chunk {
<ide> otherChunk._groups.clear();
<ide>
<ide> if (this.name && otherChunk.name) {
<del> if (this.name.length !== otherChunk.name.length)
<add> if (this.name.length !== otherChunk.name.length) {
<ide> this.name =
<ide> this.name.length < otherChunk.name.length
<ide> ? this.name
<ide> : otherChunk.name;
<del> else
<add> } else {
<ide> this.name = this.name < otherChunk.name ? this.name : otherChunk.name;
<add> }
<ide> }
<ide>
<ide> return true;
<ide> class Chunk {
<ide> for (const chunkGroup of queue) {
<ide> if (a.isInGroup(chunkGroup)) continue;
<ide> if (chunkGroup.isInitial()) return false;
<del> for (const parent of chunkGroup.parentsIterable) queue.add(parent);
<add> for (const parent of chunkGroup.parentsIterable) {
<add> queue.add(parent);
<add> }
<ide> }
<ide> return true;
<ide> };
<ide>
<del> if (this.preventIntegration || otherChunk.preventIntegration) return false;
<add> if (this.preventIntegration || otherChunk.preventIntegration) {
<add> return false;
<add> }
<ide>
<ide> if (this.hasRuntime() !== otherChunk.hasRuntime()) {
<ide> if (this.hasRuntime()) {
<ide> class Chunk {
<ide> return false;
<ide> }
<ide> }
<del> if (this.hasEntryModule() || otherChunk.hasEntryModule()) return false;
<add>
<add> if (this.hasEntryModule() || otherChunk.hasEntryModule()) {
<add> return false;
<add> }
<add>
<ide> return true;
<ide> }
<ide>
<ide> class Chunk {
<ide> );
<ide>
<ide> for (const chunkGroup of this.groupsIterable) {
<del> for (const child of chunkGroup.childrenIterable) queue.add(child);
<add> for (const child of chunkGroup.childrenIterable) {
<add> queue.add(child);
<add> }
<ide> }
<ide>
<ide> for (const chunkGroup of queue) {
<ide> for (const chunk of chunkGroup.chunks) {
<del> if (!initialChunks.has(chunk)) chunks.add(chunk);
<add> if (!initialChunks.has(chunk)) {
<add> chunks.add(chunk);
<add> }
<add> }
<add> for (const child of chunkGroup.childrenIterable) {
<add> queue.add(child);
<ide> }
<del> for (const child of chunkGroup.childrenIterable) queue.add(child);
<ide> }
<ide>
<ide> return chunks;
<ide> class Chunk {
<ide> for (const chunk of this.getAllAsyncChunks()) {
<ide> chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash;
<ide> for (const key of Object.keys(chunk.contentHash)) {
<del> if (!chunkContentHashMap[key])
<add> if (!chunkContentHashMap[key]) {
<ide> chunkContentHashMap[key] = Object.create(null);
<add> }
<ide> chunkContentHashMap[key][chunk.id] = chunk.contentHash[key];
<ide> }
<del> if (chunk.name) chunkNameMap[chunk.id] = chunk.name;
<add> if (chunk.name) {
<add> chunkNameMap[chunk.id] = chunk.name;
<add> }
<ide> }
<ide>
<ide> return {
<ide> class Chunk {
<ide> const cmp = b.order - a.order;
<ide> if (cmp !== 0) return cmp;
<ide> // TOOD webpack 5 remove this check of compareTo
<del> if (a.group.compareTo) return a.group.compareTo(b.group);
<add> if (a.group.compareTo) {
<add> return a.group.compareTo(b.group);
<add> }
<ide> return 0;
<ide> });
<ide> result[name] = Array.from(
<ide> list.reduce((set, item) => {
<del> for (const chunk of item.group.chunks) set.add(chunk.id);
<add> for (const chunk of item.group.chunks) {
<add> set.add(chunk.id);
<add> }
<ide> return set;
<ide> }, new Set())
<ide> );
<ide> class Chunk {
<ide> const data = chunk.getChildIdsByOrders();
<ide> for (const key of Object.keys(data)) {
<ide> let chunkMap = chunkMaps[key];
<del> if (chunkMap === undefined)
<add> if (chunkMap === undefined) {
<ide> chunkMaps[key] = chunkMap = Object.create(null);
<add> }
<ide> chunkMap[chunk.id] = data[key];
<ide> }
<ide> }
<ide> class Chunk {
<ide> if (!chunksProcessed.has(chunk)) {
<ide> chunksProcessed.add(chunk);
<ide> if (!filterChunkFn || filterChunkFn(chunk)) {
<del> for (const module of chunk.modulesIterable)
<del> if (filterFn(module)) return true;
<add> for (const module of chunk.modulesIterable) {
<add> if (filterFn(module)) {
<add> return true;
<add> }
<add> }
<ide> }
<ide> }
<ide> }
<del> for (const child of chunkGroup.childrenIterable) queue.add(child);
<add> for (const child of chunkGroup.childrenIterable) {
<add> queue.add(child);
<add> }
<ide> }
<ide> return false;
<ide> }
<ide><path>lib/ChunkGroup.js
<ide> class ChunkGroup {
<ide>
<ide> setParents(newParents) {
<ide> this._parents.clear();
<del> for (const p of newParents) this._parents.add(p);
<add> for (const p of newParents) {
<add> this._parents.add(p);
<add> }
<ide> }
<ide>
<ide> getNumberOfParents() {
<ide> class ChunkGroup {
<ide> if (key.endsWith("Order")) {
<ide> const name = key.substr(0, key.length - "Order".length);
<ide> let list = lists.get(name);
<del> if (list === undefined) lists.set(name, (list = []));
<add> if (list === undefined) {
<add> lists.set(name, (list = []));
<add> }
<ide> list.push({
<ide> order: childGroup.options[key],
<ide> group: childGroup
<ide> class ChunkGroup {
<ide> const cmp = b.order - a.order;
<ide> if (cmp !== 0) return cmp;
<ide> // TOOD webpack 5 remove this check of compareTo
<del> if (a.group.compareTo) return a.group.compareTo(b.group);
<add> if (a.group.compareTo) {
<add> return a.group.compareTo(b.group);
<add> }
<ide> return 0;
<ide> });
<ide> result[name] = list.map(i => i.group);
<ide> class ChunkGroup {
<ide> checkConstraints() {
<ide> const chunk = this;
<ide> for (const child of chunk._children) {
<del> if (!child._parents.has(chunk))
<add> if (!child._parents.has(chunk)) {
<ide> throw new Error(
<ide> `checkConstraints: child missing parent ${chunk.debugId} -> ${
<ide> child.debugId
<ide> }`
<ide> );
<add> }
<ide> }
<ide> for (const parentChunk of chunk._parents) {
<del> if (!parentChunk._children.has(chunk))
<add> if (!parentChunk._children.has(chunk)) {
<ide> throw new Error(
<ide> `checkConstraints: parent missing child ${parentChunk.debugId} <- ${
<ide> chunk.debugId
<ide> }`
<ide> );
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>lib/Compilation.js
<ide> class Compilation extends Tapable {
<ide> if (this.cache && this.cache[cacheName]) {
<ide> const cacheModule = this.cache[cacheName];
<ide>
<del> if (typeof cacheModule.updateCacheModule === "function")
<add> if (typeof cacheModule.updateCacheModule === "function") {
<ide> cacheModule.updateCacheModule(module);
<add> }
<ide>
<ide> let rebuild = true;
<ide> if (this.fileTimestamps && this.contextTimestamps) {
<ide> class Compilation extends Tapable {
<ide> cacheModule.disconnect();
<ide> this._modules.set(identifier, cacheModule);
<ide> this.modules.push(cacheModule);
<del> for (const err of cacheModule.errors) this.errors.push(err);
<del> for (const err of cacheModule.warnings) this.warnings.push(err);
<add> for (const err of cacheModule.errors) {
<add> this.errors.push(err);
<add> }
<add> for (const err of cacheModule.warnings) {
<add> this.warnings.push(err);
<add> }
<ide> return {
<ide> module: cacheModule,
<ide> issuer: true,
<ide> class Compilation extends Tapable {
<ide>
<ide> const callback = err => {
<ide> this._buildingModules.delete(module);
<del> for (const cb of callbackList) cb(err);
<add> for (const cb of callbackList) {
<add> cb(err);
<add> }
<ide> };
<ide>
<ide> this.hooks.buildModule.call(module);
<ide> class Compilation extends Tapable {
<ide> const err = errors[indexError];
<ide> err.origin = origin;
<ide> err.dependencies = dependencies;
<del> if (optional) this.warnings.push(err);
<del> else this.errors.push(err);
<add> if (optional) {
<add> this.warnings.push(err);
<add> } else {
<add> this.errors.push(err);
<add> }
<ide> }
<ide>
<ide> const warnings = module.warnings;
<ide> class Compilation extends Tapable {
<ide> const resourceIdent = dep.getResourceIdentifier();
<ide> if (resourceIdent) {
<ide> const factory = this.dependencyFactories.get(dep.constructor);
<del> if (factory === undefined)
<add> if (factory === undefined) {
<ide> throw new Error(
<ide> `No module factory available for dependency type: ${
<ide> dep.constructor.name
<ide> }`
<ide> );
<add> }
<ide> let innerMap = dependencies.get(factory);
<del> if (innerMap === undefined)
<add> if (innerMap === undefined) {
<ide> dependencies.set(factory, (innerMap = new Map()));
<add> }
<ide> let list = innerMap.get(resourceIdent);
<ide> if (list === undefined) innerMap.set(resourceIdent, (list = []));
<ide> list.push(dep);
<ide> class Compilation extends Tapable {
<ide>
<ide> const callback = err => {
<ide> this._rebuildingModules.delete(module);
<del> for (const cb of callbackList) cb(err);
<add> for (const cb of callbackList) {
<add> cb(err);
<add> }
<ide> };
<ide>
<ide> this.hooks.rebuildModule.call(module);
<ide> class Compilation extends Tapable {
<ide>
<ide> this.sortItemsWithChunkIds();
<ide>
<del> if (shouldRecord)
<add> if (shouldRecord) {
<ide> this.hooks.recordModules.call(this.modules, this.records);
<del> if (shouldRecord) this.hooks.recordChunks.call(this.chunks, this.records);
<add> this.hooks.recordChunks.call(this.chunks, this.records);
<add> }
<ide>
<ide> this.hooks.beforeHash.call();
<ide> this.createHash();
<ide> this.hooks.afterHash.call();
<ide>
<del> if (shouldRecord) this.hooks.recordHash.call(this.records);
<add> if (shouldRecord) {
<add> this.hooks.recordHash.call(this.records);
<add> }
<ide>
<ide> this.hooks.beforeModuleAssets.call();
<ide> this.createModuleAssets();
<ide> class Compilation extends Tapable {
<ide> }
<ide> this.hooks.additionalChunkAssets.call(this.chunks);
<ide> this.summarizeDependencies();
<del> if (shouldRecord) this.hooks.record.call(this, this.records);
<add> if (shouldRecord) {
<add> this.hooks.record.call(this, this.records);
<add> }
<ide>
<ide> this.hooks.additionalAssets.callAsync(err => {
<ide> if (err) {
<ide> class Compilation extends Tapable {
<ide>
<ide> // 3. Create a new Set of available modules at this points
<ide> newAvailableModules = new Set(availableModules);
<del> for (const chunk of chunkGroup.chunks)
<del> for (const m of chunk.modulesIterable) newAvailableModules.add(m);
<add> for (const chunk of chunkGroup.chunks) {
<add> for (const m of chunk.modulesIterable) {
<add> newAvailableModules.add(m);
<add> }
<add> }
<ide>
<ide> // 4. Filter edges with available modules
<ide> const filteredDeps = deps.filter(filterFn);
<ide> class Compilation extends Tapable {
<ide> for (let indexModule2 = 0; indexModule2 < modules2.length; indexModule2++) {
<ide> const module2 = modules2[indexModule2];
<ide> if (module2.id === null) {
<del> if (unusedIds.length > 0) module2.id = unusedIds.pop();
<del> else module2.id = nextFreeModuleId++;
<add> if (unusedIds.length > 0) {
<add> module2.id = unusedIds.pop();
<add> } else {
<add> module2.id = nextFreeModuleId++;
<add> }
<ide> }
<ide> }
<ide> }
<ide> class Compilation extends Tapable {
<ide> for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
<ide> const chunk = chunks[indexChunk];
<ide> if (chunk.id === null) {
<del> if (unusedIds.length > 0) chunk.id = unusedIds.pop();
<del> else chunk.id = nextFreeChunkId++;
<add> if (unusedIds.length > 0) {
<add> chunk.id = unusedIds.pop();
<add> } else {
<add> chunk.id = nextFreeChunkId++;
<add> }
<ide> }
<ide> if (!chunk.ids) {
<ide> chunk.ids = [chunk.id];
<ide> class Compilation extends Tapable {
<ide> const hashDigest = outputOptions.hashDigest;
<ide> const hashDigestLength = outputOptions.hashDigestLength;
<ide> const hash = createHash(hashFunction);
<del> if (outputOptions.hashSalt) hash.update(outputOptions.hashSalt);
<add> if (outputOptions.hashSalt) {
<add> hash.update(outputOptions.hashSalt);
<add> }
<ide> this.mainTemplate.updateHash(hash);
<ide> this.chunkTemplate.updateHash(hash);
<del> for (const key of Object.keys(this.moduleTemplates).sort())
<add> for (const key of Object.keys(this.moduleTemplates).sort()) {
<ide> this.moduleTemplates[key].updateHash(hash);
<del> for (const child of this.children) hash.update(child.hash);
<del> for (const warning of this.warnings) hash.update(`${warning.message}`);
<del> for (const error of this.errors) hash.update(`${error.message}`);
<add> }
<add> for (const child of this.children) {
<add> hash.update(child.hash);
<add> }
<add> for (const warning of this.warnings) {
<add> hash.update(`${warning.message}`);
<add> }
<add> for (const error of this.errors) {
<add> hash.update(`${error.message}`);
<add> }
<ide> const modules = this.modules;
<ide> for (let i = 0; i < modules.length; i++) {
<ide> const module = modules[i];
<ide> class Compilation extends Tapable {
<ide> for (let i = 0; i < chunks.length; i++) {
<ide> const chunk = chunks[i];
<ide> const chunkHash = createHash(hashFunction);
<del> if (outputOptions.hashSalt) chunkHash.update(outputOptions.hashSalt);
<add> if (outputOptions.hashSalt) {
<add> chunkHash.update(outputOptions.hashSalt);
<add> }
<ide> chunk.updateHash(chunkHash);
<ide> const template = chunk.hasRuntime()
<ide> ? this.mainTemplate
<ide> class Compilation extends Tapable {
<ide> }
<ide> }
<ide> file = this.getPath(filenameTemplate, fileManifest.pathOptions);
<del> if (this.assets[file] && this.assets[file] !== source)
<add> if (this.assets[file] && this.assets[file] !== source) {
<ide> throw new Error(
<ide> `Conflict: Multiple assets emit to the same filename ${file}`
<ide> );
<add> }
<ide> this.assets[file] = source;
<ide> chunk.files.push(file);
<ide> this.hooks.chunkAsset.call(chunk, file);
<ide> class Compilation extends Tapable {
<ide> for (let indexModule = 0; indexModule < modules.length; indexModule++) {
<ide> const moduleId = modules[indexModule].id;
<ide> if (moduleId === null) continue;
<del> if (usedIds.has(moduleId))
<add> if (usedIds.has(moduleId)) {
<ide> throw new Error(`checkConstraints: duplicate module id ${moduleId}`);
<add> }
<ide> usedIds.add(moduleId);
<ide> }
<ide>
<ide> const chunks = this.chunks;
<ide> for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
<ide> const chunk = chunks[indexChunk];
<del> if (chunks.indexOf(chunk) !== indexChunk)
<add> if (chunks.indexOf(chunk) !== indexChunk) {
<ide> throw new Error(
<ide> `checkConstraints: duplicate chunk in compilation ${chunk.debugId}`
<ide> );
<add> }
<ide> }
<ide>
<ide> for (const chunkGroup of this.chunkGroups) {
<ide><path>lib/Compiler.js
<ide> class Compiler extends Tapable {
<ide> }
<ide>
<ide> purgeInputFileSystem() {
<del> if (this.inputFileSystem && this.inputFileSystem.purge)
<add> if (this.inputFileSystem && this.inputFileSystem.purge) {
<ide> this.inputFileSystem.purge();
<add> }
<ide> }
<ide>
<ide> emitAssets(compilation, callback) {
<ide> class Compiler extends Tapable {
<ide> this.outputFileSystem.join(outputPath, dir),
<ide> writeOut
<ide> );
<del> } else writeOut();
<add> } else {
<add> writeOut();
<add> }
<ide> },
<ide> err => {
<ide> if (err) return callback(err);
<ide> class Compiler extends Tapable {
<ide> const idx1 = this.recordsOutputPath.lastIndexOf("/");
<ide> const idx2 = this.recordsOutputPath.lastIndexOf("\\");
<ide> let recordsOutputPathDirectory = null;
<del> if (idx1 > idx2)
<add> if (idx1 > idx2) {
<ide> recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx1);
<del> if (idx1 < idx2)
<add> } else if (idx1 < idx2) {
<ide> recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx2);
<add> }
<ide>
<ide> const writeFile = () => {
<ide> this.outputFileSystem.writeFile(
<ide> class Compiler extends Tapable {
<ide> );
<ide> };
<ide>
<del> if (!recordsOutputPathDirectory) return writeFile();
<add> if (!recordsOutputPathDirectory) {
<add> return writeFile();
<add> }
<ide> this.outputFileSystem.mkdirp(recordsOutputPathDirectory, err => {
<ide> if (err) return callback(err);
<ide> writeFile();
<ide> class Compiler extends Tapable {
<ide> ) {
<ide> const childCompiler = new Compiler(this.context);
<ide> if (Array.isArray(plugins)) {
<del> for (const plugin of plugins) plugin.apply(childCompiler);
<add> for (const plugin of plugins) {
<add> plugin.apply(childCompiler);
<add> }
<ide> }
<ide> for (const name in this.hooks) {
<ide> if (
<ide> class Compiler extends Tapable {
<ide> "thisCompilation"
<ide> ].includes(name)
<ide> ) {
<del> if (childCompiler.hooks[name])
<add> if (childCompiler.hooks[name]) {
<ide> childCompiler.hooks[name].taps = this.hooks[name].taps.slice();
<add> }
<ide> }
<ide> }
<ide> childCompiler.name = compilerName;
<ide> class Compiler extends Tapable {
<ide> childCompiler.contextTimestamps = this.contextTimestamps;
<ide>
<ide> const relativeCompilerName = makePathsRelative(this.context, compilerName);
<del> if (!this.records[relativeCompilerName])
<add> if (!this.records[relativeCompilerName]) {
<ide> this.records[relativeCompilerName] = [];
<del> if (this.records[relativeCompilerName][compilerIndex])
<add> }
<add> if (this.records[relativeCompilerName][compilerIndex]) {
<ide> childCompiler.records = this.records[relativeCompilerName][compilerIndex];
<del> else this.records[relativeCompilerName].push((childCompiler.records = {}));
<add> } else {
<add> this.records[relativeCompilerName].push((childCompiler.records = {}));
<add> }
<ide>
<ide> childCompiler.options = Object.create(this.options);
<ide> childCompiler.options.output = Object.create(childCompiler.options.output);
<ide><path>lib/ConstPlugin.js
<ide> const collectDeclaration = (declarations, pattern) => {
<ide> declarations.add(node.name);
<ide> break;
<ide> case "ArrayPattern":
<del> for (const element of node.elements) if (element) stack.push(element);
<add> for (const element of node.elements) {
<add> if (element) {
<add> stack.push(element);
<add> }
<add> }
<ide> break;
<ide> case "AssignmentPattern":
<ide> stack.push(node.left);
<ide> break;
<ide> case "ObjectPattern":
<del> for (const property of node.properties) stack.push(property.value);
<add> for (const property of node.properties) {
<add> stack.push(property.value);
<add> }
<ide> break;
<ide> case "RestElement":
<ide> stack.push(node.argument);
<ide> const getHoistedDeclarations = (branch, includeFunctionDeclarations) => {
<ide> // Walk through control statements to look for hoisted declarations.
<ide> // Some branches are skipped since they do not allow declarations.
<ide> case "BlockStatement":
<del> for (const stmt of node.body) stack.push(stmt);
<add> for (const stmt of node.body) {
<add> stack.push(stmt);
<add> }
<ide> break;
<ide> case "IfStatement":
<ide> stack.push(node.consequent);
<ide> const getHoistedDeclarations = (branch, includeFunctionDeclarations) => {
<ide> stack.push(node.body);
<ide> break;
<ide> case "SwitchStatement":
<del> for (const cs of node.cases)
<del> for (const consequent of cs.consequent) stack.push(consequent);
<add> for (const cs of node.cases) {
<add> for (const consequent of cs.consequent) {
<add> stack.push(consequent);
<add> }
<add> }
<ide> break;
<ide> case "TryStatement":
<ide> stack.push(node.block);
<del> if (node.handler) stack.push(node.handler.body);
<add> if (node.handler) {
<add> stack.push(node.handler.body);
<add> }
<ide> stack.push(node.finalizer);
<ide> break;
<ide> case "FunctionDeclaration":
<del> if (includeFunctionDeclarations)
<add> if (includeFunctionDeclarations) {
<ide> collectDeclaration(declarations, node.id);
<add> }
<ide> break;
<ide> case "VariableDeclaration":
<del> if (node.kind === "var")
<del> for (const decl of node.declarations)
<add> if (node.kind === "var") {
<add> for (const decl of node.declarations) {
<ide> collectDeclaration(declarations, decl.id);
<add> }
<add> }
<ide> break;
<ide> }
<ide> }
<ide><path>lib/ContextModule.js
<ide> class ContextModule extends Module {
<ide> resource: resource,
<ide> resourceQuery: resourceQuery
<ide> });
<del> if (options.resolveOptions !== undefined)
<add> if (options.resolveOptions !== undefined) {
<ide> this.resolveOptions = options.resolveOptions;
<add> }
<ide>
<ide> // Info from Build
<ide> this._contextDependencies = new Set([this.context]);
<ide>
<del> if (typeof options.mode !== "string")
<add> if (typeof options.mode !== "string") {
<ide> throw new Error("options.mode is a required option");
<add> }
<ide>
<ide> this._identifier = this._createIdentifier();
<ide> }
<ide> class ContextModule extends Module {
<ide>
<ide> _createIdentifier() {
<ide> let identifier = this.context;
<del> if (this.options.resourceQuery)
<add> if (this.options.resourceQuery) {
<ide> identifier += ` ${this.options.resourceQuery}`;
<del> if (this.options.mode) identifier += ` ${this.options.mode}`;
<del> if (!this.options.recursive) identifier += " nonrecursive";
<del> if (this.options.addon) identifier += ` ${this.options.addon}`;
<del> if (this.options.regExp) identifier += ` ${this.options.regExp}`;
<del> if (this.options.include) identifier += ` include: ${this.options.include}`;
<del> if (this.options.exclude) identifier += ` exclude: ${this.options.exclude}`;
<add> }
<add> if (this.options.mode) {
<add> identifier += ` ${this.options.mode}`;
<add> }
<add> if (!this.options.recursive) {
<add> identifier += " nonrecursive";
<add> }
<add> if (this.options.addon) {
<add> identifier += ` ${this.options.addon}`;
<add> }
<add> if (this.options.regExp) {
<add> identifier += ` ${this.options.regExp}`;
<add> }
<add> if (this.options.include) {
<add> identifier += ` include: ${this.options.include}`;
<add> }
<add> if (this.options.exclude) {
<add> identifier += ` exclude: ${this.options.exclude}`;
<add> }
<ide> if (this.options.groupOptions) {
<ide> identifier += ` groupOptions: ${JSON.stringify(
<ide> this.options.groupOptions
<ide> )}`;
<ide> }
<del> if (this.options.namespaceObject === "strict")
<add> if (this.options.namespaceObject === "strict") {
<ide> identifier += " strict namespace object";
<del> else if (this.options.namespaceObject) identifier += " namespace object";
<add> } else if (this.options.namespaceObject) {
<add> identifier += " namespace object";
<add> }
<ide>
<ide> return identifier;
<ide> }
<ide> class ContextModule extends Module {
<ide>
<ide> readableIdentifier(requestShortener) {
<ide> let identifier = requestShortener.shorten(this.context);
<del> if (this.options.resourceQuery)
<add> if (this.options.resourceQuery) {
<ide> identifier += ` ${this.options.resourceQuery}`;
<del> if (this.options.mode) identifier += ` ${this.options.mode}`;
<del> if (!this.options.recursive) identifier += " nonrecursive";
<del> if (this.options.addon)
<add> }
<add> if (this.options.mode) {
<add> identifier += ` ${this.options.mode}`;
<add> }
<add> if (!this.options.recursive) {
<add> identifier += " nonrecursive";
<add> }
<add> if (this.options.addon) {
<ide> identifier += ` ${requestShortener.shorten(this.options.addon)}`;
<del> if (this.options.regExp)
<add> }
<add> if (this.options.regExp) {
<ide> identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
<del> if (this.options.include)
<add> }
<add> if (this.options.include) {
<ide> identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
<del> if (this.options.exclude)
<add> }
<add> if (this.options.exclude) {
<ide> identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
<add> }
<ide> if (this.options.groupOptions) {
<ide> const groupOptions = this.options.groupOptions;
<del> for (const key of Object.keys(groupOptions))
<add> for (const key of Object.keys(groupOptions)) {
<ide> identifier += ` ${key}: ${groupOptions[key]}`;
<add> }
<ide> }
<del> if (this.options.namespaceObject === "strict")
<add> if (this.options.namespaceObject === "strict") {
<ide> identifier += " strict namespace object";
<del> else if (this.options.namespaceObject) identifier += " namespace object";
<add> } else if (this.options.namespaceObject) {
<add> identifier += " namespace object";
<add> }
<ide>
<ide> return identifier;
<ide> }
<ide>
<ide> libIdent(options) {
<ide> let identifier = this.contextify(options.context, this.context);
<del> if (this.options.mode) identifier += ` ${this.options.mode}`;
<del> if (this.options.recursive) identifier += " recursive";
<del> if (this.options.addon)
<add> if (this.options.mode) {
<add> identifier += ` ${this.options.mode}`;
<add> }
<add> if (this.options.recursive) {
<add> identifier += " recursive";
<add> }
<add> if (this.options.addon) {
<ide> identifier += ` ${this.contextify(options.context, this.options.addon)}`;
<del> if (this.options.regExp)
<add> }
<add> if (this.options.regExp) {
<ide> identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
<del> if (this.options.include)
<add> }
<add> if (this.options.include) {
<ide> identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
<del> if (this.options.exclude)
<add> }
<add> if (this.options.exclude) {
<ide> identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
<add> }
<ide>
<ide> return identifier;
<ide> }
<ide> class ContextModule extends Module {
<ide> for (const dep of dependencies) {
<ide> let chunkName = this.options.chunkName;
<ide> if (chunkName) {
<del> if (!/\[(index|request)\]/.test(chunkName)) chunkName += "[index]";
<add> if (!/\[(index|request)\]/.test(chunkName)) {
<add> chunkName += "[index]";
<add> }
<ide> chunkName = chunkName.replace(/\[index\]/g, index++);
<ide> chunkName = chunkName.replace(
<ide> /\[request\]/g,
<ide> class ContextModule extends Module {
<ide> }
<ide>
<ide> getFakeMap(dependencies) {
<del> if (!this.options.namespaceObject) return 9;
<add> if (!this.options.namespaceObject) {
<add> return 9;
<add> }
<ide> // if we filter first we get a new array
<ide> // therefor we dont need to create a clone of dependencies explicitly
<ide> // therefore the order of this is !important!
<ide> class ContextModule extends Module {
<ide> }
<ide> return map;
<ide> }, Object.create(null));
<del> if (!hasNamespace && hasNonHarmony && !hasNamed)
<add> if (!hasNamespace && hasNonHarmony && !hasNamed) {
<ide> return this.options.namespaceObject === "strict" ? 1 : 7;
<del> if (hasNamespace && !hasNonHarmony && !hasNamed) return 9;
<del> if (!hasNamespace && !hasNonHarmony && hasNamed) return 3;
<del> if (!hasNamespace && !hasNonHarmony && !hasNamed) return 9;
<add> }
<add> if (hasNamespace && !hasNonHarmony && !hasNamed) {
<add> return 9;
<add> }
<add> if (!hasNamespace && !hasNonHarmony && hasNamed) {
<add> return 3;
<add> }
<add> if (!hasNamespace && !hasNonHarmony && !hasNamed) {
<add> return 9;
<add> }
<ide> return fakeMap;
<ide> }
<ide>
<ide> class ContextModule extends Module {
<ide> }
<ide>
<ide> getReturn(type) {
<del> if (type === 9) return "__webpack_require__(id)";
<add> if (type === 9) {
<add> return "__webpack_require__(id)";
<add> }
<ide> return `__webpack_require__.t(id, ${type})`;
<ide> }
<ide>
<ide> getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
<del> if (typeof fakeMap === "number")
<add> if (typeof fakeMap === "number") {
<ide> return `return ${this.getReturn(fakeMap)};`;
<add> }
<ide> return `return __webpack_require__.t(id, ${fakeMapDataExpression})`;
<ide> }
<ide>
<ide> module.exports = webpackAsyncContext;`;
<ide> hasMultipleOrNoChunks = true;
<ide> }
<ide> const arrayStart = [item.dependency.module.id];
<del> if (typeof fakeMap === "object")
<add> if (typeof fakeMap === "object") {
<ide> arrayStart.push(fakeMap[item.dependency.module.id]);
<add> }
<ide> map[item.userRequest] = arrayStart.concat(
<ide> chunks.map(chunk => chunk.id)
<ide> );
<ide><path>lib/ContextModuleFactory.js
<ide> module.exports = class ContextModuleFactory extends Tapable {
<ide> loadersPrefix = "";
<ide> const idx = request.lastIndexOf("!");
<ide> if (idx >= 0) {
<del> loaders = request.substr(0, idx + 1);
<add> let loadersRequest = request.substr(0, idx + 1);
<ide> let i;
<del> for (i = 0; i < loaders.length && loaders[i] === "!"; i++) {
<add> for (
<add> i = 0;
<add> i < loadersRequest.length && loadersRequest[i] === "!";
<add> i++
<add> ) {
<ide> loadersPrefix += "!";
<ide> }
<del> loaders = loaders
<add> loadersRequest = loadersRequest
<ide> .substr(i)
<ide> .replace(/!+$/, "")
<ide> .replace(/!!+/g, "!");
<del> if (loaders === "") loaders = [];
<del> else loaders = loaders.split("!");
<add> if (loadersRequest === "") {
<add> loaders = [];
<add> } else {
<add> loaders = loadersRequest.split("!");
<add> }
<ide> resource = request.substr(idx + 1);
<ide> } else {
<ide> loaders = [];
<ide> module.exports = class ContextModuleFactory extends Tapable {
<ide> callback(null, alternatives);
<ide> }
<ide> );
<del> } else callback();
<add> } else {
<add> callback();
<add> }
<ide> });
<del> } else callback();
<add> } else {
<add> callback();
<add> }
<ide> },
<ide> (err, result) => {
<ide> if (err) return callback(err);
<ide><path>lib/ContextReplacementPlugin.js
<ide> class ContextReplacementPlugin {
<ide> cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => {
<ide> if (!result) return;
<ide> if (resourceRegExp.test(result.request)) {
<del> if (typeof newContentResource !== "undefined")
<add> if (typeof newContentResource !== "undefined") {
<ide> result.request = newContentResource;
<del> if (typeof newContentRecursive !== "undefined")
<add> }
<add> if (typeof newContentRecursive !== "undefined") {
<ide> result.recursive = newContentRecursive;
<del> if (typeof newContentRegExp !== "undefined")
<add> }
<add> if (typeof newContentRegExp !== "undefined") {
<ide> result.regExp = newContentRegExp;
<add> }
<ide> if (typeof newContentCallback === "function") {
<ide> newContentCallback(result);
<ide> } else {
<ide> class ContextReplacementPlugin {
<ide> cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => {
<ide> if (!result) return;
<ide> if (resourceRegExp.test(result.resource)) {
<del> if (typeof newContentResource !== "undefined")
<add> if (typeof newContentResource !== "undefined") {
<ide> result.resource = path.resolve(result.resource, newContentResource);
<del> if (typeof newContentRecursive !== "undefined")
<add> }
<add> if (typeof newContentRecursive !== "undefined") {
<ide> result.recursive = newContentRecursive;
<del> if (typeof newContentRegExp !== "undefined")
<add> }
<add> if (typeof newContentRegExp !== "undefined") {
<ide> result.regExp = newContentRegExp;
<del> if (typeof newContentCreateContextMap === "function")
<add> }
<add> if (typeof newContentCreateContextMap === "function") {
<ide> result.resolveDependencies = createResolveDependenciesFromContextMap(
<ide> newContentCreateContextMap
<ide> );
<add> }
<ide> if (typeof newContentCallback === "function") {
<ide> const origResource = result.resource;
<ide> newContentCallback(result);
<ide><path>lib/DefinePlugin.js
<ide> const stringifyObj = obj => {
<ide> };
<ide>
<ide> const toCode = code => {
<del> if (code === null) return "null";
<del> else if (code === undefined) return "undefined";
<del> else if (code instanceof RegExp && code.toString) return code.toString();
<del> else if (typeof code === "function" && code.toString)
<add> if (code === null) {
<add> return "null";
<add> }
<add> if (code === undefined) {
<add> return "undefined";
<add> }
<add> if (code instanceof RegExp && code.toString) {
<add> return code.toString();
<add> }
<add> if (typeof code === "function" && code.toString) {
<ide> return "(" + code.toString() + ")";
<del> else if (typeof code === "object") return stringifyObj(code);
<del> else return code + "";
<add> }
<add> if (typeof code === "object") {
<add> return stringifyObj(code);
<add> }
<add> return code + "";
<ide> };
<ide>
<ide> class DefinePlugin {
<ide><path>lib/DependenciesBlock.js
<ide> class DependenciesBlock {
<ide>
<ide> removeDependency(dependency) {
<ide> const idx = this.dependencies.indexOf(dependency);
<del> if (idx >= 0) this.dependencies.splice(idx, 1);
<add> if (idx >= 0) {
<add> this.dependencies.splice(idx, 1);
<add> }
<ide> }
<ide>
<ide> updateHash(hash) {
<ide><path>lib/DependenciesBlockVariable.js
<ide> class DependenciesBlockVariable {
<ide> const source = new ReplaceSource(new RawSource(this.expression));
<ide> for (const dep of this.dependencies) {
<ide> const template = dependencyTemplates.get(dep.constructor);
<del> if (!template)
<add> if (!template) {
<ide> throw new Error(`No template for dependency: ${dep.constructor.name}`);
<add> }
<ide> template.apply(dep, source, runtimeTemplate, dependencyTemplates);
<ide> }
<ide> return source;
<ide><path>lib/DllPlugin.js
<ide> class DllPlugin {
<ide> apply(compiler) {
<ide> compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => {
<ide> const itemToPlugin = (item, name) => {
<del> if (Array.isArray(item)) return new DllEntryPlugin(context, item, name);
<del> else throw new Error("DllPlugin: supply an Array as entry");
<add> if (Array.isArray(item)) {
<add> return new DllEntryPlugin(context, item, name);
<add> }
<add> throw new Error("DllPlugin: supply an Array as entry");
<ide> };
<ide> if (typeof entry === "object" && !Array.isArray(entry)) {
<ide> Object.keys(entry).forEach(name => {
<ide><path>lib/DynamicEntryPlugin.js
<ide> class DynamicEntryPlugin {
<ide> module.exports = DynamicEntryPlugin;
<ide>
<ide> DynamicEntryPlugin.createDependency = (entry, name) => {
<del> if (Array.isArray(entry))
<add> if (Array.isArray(entry)) {
<ide> return MultiEntryPlugin.createDependency(entry, name);
<del> else return SingleEntryPlugin.createDependency(entry, name);
<add> } else {
<add> return SingleEntryPlugin.createDependency(entry, name);
<add> }
<ide> };
<ide><path>lib/ErrorHelpers.js
<ide> const webpackOptionsFlag = "WEBPACK_OPTIONS";
<ide>
<ide> exports.cutOffByFlag = (stack, flag) => {
<ide> stack = stack.split("\n");
<del> for (let i = 0; i < stack.length; i++)
<del> if (stack[i].includes(flag)) stack.length = i;
<add> for (let i = 0; i < stack.length; i++) {
<add> if (stack[i].includes(flag)) {
<add> stack.length = i;
<add> }
<add> }
<ide> return stack.join("\n");
<ide> };
<ide>
<ide><path>lib/EvalSourceMapDevToolPlugin.js
<ide> const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOpt
<ide>
<ide> class EvalSourceMapDevToolPlugin {
<ide> constructor(options) {
<del> if (arguments.length > 1)
<add> if (arguments.length > 1) {
<ide> throw new Error(
<ide> "EvalSourceMapDevToolPlugin only takes one argument (pass an options object)"
<ide> );
<add> }
<ide> if (typeof options === "string") {
<ide> options = {
<ide> append: options
<ide><path>lib/FlagDependencyUsagePlugin.js
<ide> class FlagDependencyUsagePlugin {
<ide> const processModule = (module, usedExports) => {
<ide> module.used = true;
<ide> if (module.usedExports === true) return;
<del> else if (usedExports === true) module.usedExports = true;
<del> else if (Array.isArray(usedExports)) {
<add> if (usedExports === true) {
<add> module.usedExports = true;
<add> } else if (Array.isArray(usedExports)) {
<ide> const old = module.usedExports ? module.usedExports.length : -1;
<ide> module.usedExports = addToSet(
<ide> module.usedExports || [],
<ide> usedExports
<ide> );
<del> if (module.usedExports.length === old) return;
<del> } else if (Array.isArray(module.usedExports)) return;
<del> else module.usedExports = false;
<add> if (module.usedExports.length === old) {
<add> return;
<add> }
<add> } else if (Array.isArray(module.usedExports)) {
<add> return;
<add> } else {
<add> module.usedExports = false;
<add> }
<ide>
<ide> // for a module without side effects we stop tracking usage here when no export is used
<ide> // This module won't be evaluated in this case
<ide><path>lib/FunctionModuleTemplatePlugin.js
<ide> class FunctionModuleTemplatePlugin {
<ide> if (
<ide> Array.isArray(module.buildMeta.providedExports) &&
<ide> module.buildMeta.providedExports.length === 0
<del> )
<add> ) {
<ide> source.add(Template.toComment("no exports provided") + "\n");
<del> else if (Array.isArray(module.buildMeta.providedExports))
<add> } else if (Array.isArray(module.buildMeta.providedExports)) {
<ide> source.add(
<ide> Template.toComment(
<ide> "exports provided: " +
<ide> module.buildMeta.providedExports.join(", ")
<ide> ) + "\n"
<ide> );
<del> else if (module.buildMeta.providedExports)
<add> } else if (module.buildMeta.providedExports) {
<ide> source.add(Template.toComment("no static exports found") + "\n");
<add> }
<ide> if (
<ide> Array.isArray(module.usedExports) &&
<ide> module.usedExports.length === 0
<del> )
<add> ) {
<ide> source.add(Template.toComment("no exports used") + "\n");
<del> else if (Array.isArray(module.usedExports))
<add> } else if (Array.isArray(module.usedExports)) {
<ide> source.add(
<ide> Template.toComment(
<ide> "exports used: " + module.usedExports.join(", ")
<ide> ) + "\n"
<ide> );
<del> else if (module.usedExports)
<add> } else if (module.usedExports) {
<ide> source.add(Template.toComment("all exports used") + "\n");
<add> }
<ide> if (module.optimizationBailout) {
<ide> for (const text of module.optimizationBailout) {
<ide> let code;
<ide><path>lib/HotModuleReplacement.runtime.js
<ide> module.exports = function() {
<ide> var fn = function(request) {
<ide> if (me.hot.active) {
<ide> if (installedModules[request]) {
<del> if (installedModules[request].parents.indexOf(moduleId) === -1)
<add> if (installedModules[request].parents.indexOf(moduleId) === -1) {
<ide> installedModules[request].parents.push(moduleId);
<add> }
<ide> } else {
<ide> hotCurrentParents = [moduleId];
<ide> hotCurrentChildModule = request;
<ide> }
<del> if (me.children.indexOf(request) === -1) me.children.push(request);
<add> if (me.children.indexOf(request) === -1) {
<add> me.children.push(request);
<add> }
<ide> } else {
<ide> console.warn(
<ide> "[HMR] unexpected require(" +
<ide> module.exports = function() {
<ide> }
<ide>
<ide> function hotCheck(apply) {
<del> if (hotStatus !== "idle")
<add> if (hotStatus !== "idle") {
<ide> throw new Error("check() is only allowed in idle status");
<add> }
<ide> hotApplyOnUpdate = apply;
<ide> hotSetStatus("check");
<ide> return hotDownloadManifest(hotRequestTimeout).then(function(update) {
<ide><path>lib/HotModuleReplacementPlugin.js
<ide> module.exports = class HotModuleReplacementPlugin {
<ide> mainTemplate.hooks.currentHash.tap(
<ide> "HotModuleReplacementPlugin",
<ide> (_, length) => {
<del> if (isFinite(length)) return `hotCurrentHash.substr(0, ${length})`;
<del> else return "hotCurrentHash";
<add> if (isFinite(length)) {
<add> return `hotCurrentHash.substr(0, ${length})`;
<add> } else {
<add> return "hotCurrentHash";
<add> }
<ide> }
<ide> );
<ide>
<ide> module.exports = class HotModuleReplacementPlugin {
<ide> }
<ide> );
<ide> // TODO webpack 5: refactor this, no custom hooks
<del> if (!parser.hooks.hotAcceptCallback)
<add> if (!parser.hooks.hotAcceptCallback) {
<ide> parser.hooks.hotAcceptCallback = new SyncBailHook([
<ide> "expression",
<ide> "requests"
<ide> ]);
<del> if (!parser.hooks.hotAcceptWithoutCallback)
<add> }
<add> if (!parser.hooks.hotAcceptWithoutCallback) {
<ide> parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
<ide> "expression",
<ide> "requests"
<ide> ]);
<add> }
<ide> parser.hooks.call
<ide> .for("module.hot.accept")
<ide> .tap("HotModuleReplacementPlugin", expr => {
<del> if (!parser.state.compilation.hotUpdateChunkTemplate)
<add> if (!parser.state.compilation.hotUpdateChunkTemplate) {
<ide> return false;
<add> }
<ide> if (expr.arguments.length >= 1) {
<ide> const arg = parser.evaluateExpression(expr.arguments[0]);
<ide> let params = [];
<ide> module.exports = class HotModuleReplacementPlugin {
<ide> parser.hooks.call
<ide> .for("module.hot.decline")
<ide> .tap("HotModuleReplacementPlugin", expr => {
<del> if (!parser.state.compilation.hotUpdateChunkTemplate)
<add> if (!parser.state.compilation.hotUpdateChunkTemplate) {
<ide> return false;
<add> }
<ide> if (expr.arguments.length === 1) {
<ide> const arg = parser.evaluateExpression(expr.arguments[0]);
<ide> let params = [];
<ide><path>lib/JavascriptGenerator.js
<ide> class JavascriptGenerator {
<ide>
<ide> sourceDependency(dependency, dependencyTemplates, source, runtimeTemplate) {
<ide> const template = dependencyTemplates.get(dependency.constructor);
<del> if (!template)
<add> if (!template) {
<ide> throw new Error(
<ide> "No template for dependency: " + dependency.constructor.name
<ide> );
<add> }
<ide> template.apply(dependency, source, runtimeTemplate, dependencyTemplates);
<ide> }
<ide>
<ide><path>lib/JavascriptModulesPlugin.js
<ide> class JavascriptModulesPlugin {
<ide> const moduleTemplates = options.moduleTemplates;
<ide> const dependencyTemplates = options.dependencyTemplates;
<ide>
<del> let filenameTemplate;
<del> if (chunk.filenameTemplate)
<del> filenameTemplate = chunk.filenameTemplate;
<del> else filenameTemplate = outputOptions.filename;
<add> const filenameTemplate =
<add> chunk.filenameTemplate || outputOptions.filename;
<ide>
<ide> const useChunkHash = compilation.mainTemplate.useChunkHash(chunk);
<ide>
<ide> class JavascriptModulesPlugin {
<ide> const outputOptions = options.outputOptions;
<ide> const moduleTemplates = options.moduleTemplates;
<ide> const dependencyTemplates = options.dependencyTemplates;
<del>
<del> let filenameTemplate;
<del> if (chunk.filenameTemplate)
<del> filenameTemplate = chunk.filenameTemplate;
<del> else filenameTemplate = outputOptions.chunkFilename;
<add> const filenameTemplate =
<add> chunk.filenameTemplate || outputOptions.chunkFilename;
<ide>
<ide> result.push({
<ide> render: () =>
<ide><path>lib/JsonParser.js
<ide> class JsonParser {
<ide> const data = parseJson(source[0] === "\ufeff" ? source.slice(1) : source);
<ide> state.module.buildInfo.jsonData = data;
<ide> state.module.buildMeta.exportsType = "named";
<del> if (typeof data === "object" && data)
<add> if (typeof data === "object" && data) {
<ide> state.module.addDependency(new JsonExportsDependency(Object.keys(data)));
<add> }
<ide> state.module.addDependency(new JsonExportsDependency(["default"]));
<ide> return state;
<ide> }
<ide><path>lib/LibraryTemplatePlugin.js
<ide> const accessorAccess = (base, accessor, joinWith = "; ") => {
<ide> ? base + accessorToObjectAccess(accessors.slice(0, idx + 1))
<ide> : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1));
<ide> if (idx === accessors.length - 1) return a;
<del> if (idx === 0 && typeof base === "undefined")
<add> if (idx === 0 && typeof base === "undefined") {
<ide> return `${a} = typeof ${a} === "object" ? ${a} : {}`;
<add> }
<ide> return `${a} = ${a} || {}`;
<ide> })
<ide> .join(joinWith);
<ide><path>lib/LoaderOptionsPlugin.js
<ide> class LoaderOptionsPlugin {
<ide> validateOptions(schema, options || {}, "Loader Options Plugin");
<ide>
<ide> if (typeof options !== "object") options = {};
<del> if (!options.test)
<add> if (!options.test) {
<ide> options.test = {
<ide> test: () => true
<ide> };
<add> }
<ide> this.options = options;
<ide> }
<ide>
<ide><path>lib/MainTemplate.js
<ide> module.exports = class MainTemplate extends Tapable {
<ide> if (chunk.hasEntryModule()) {
<ide> source = this.hooks.renderWithEntry.call(source, chunk, hash);
<ide> }
<del> if (!source)
<add> if (!source) {
<ide> throw new Error(
<ide> "Compiler error: MainTemplate plugin 'render' should return something"
<ide> );
<add> }
<ide> chunk.rendered = true;
<ide> return new ConcatSource(source, ";");
<ide> }
<ide><path>lib/Module.js
<ide> class Module extends DependenciesBlock {
<ide>
<ide> hasReasonForChunk(chunk) {
<ide> if (this._rewriteChunkInReasons) {
<del> for (const operation of this._rewriteChunkInReasons)
<add> for (const operation of this._rewriteChunkInReasons) {
<ide> this._doRewriteChunkInReasons(operation.oldChunk, operation.newChunks);
<add> }
<ide> this._rewriteChunkInReasons = undefined;
<ide> }
<ide> for (let i = 0; i < this.reasons.length; i++) {
<ide> class Module extends DependenciesBlock {
<ide>
<ide> rewriteChunkInReasons(oldChunk, newChunks) {
<ide> // This is expensive. Delay operation until we really need the data
<del> if (this._rewriteChunkInReasons === undefined)
<add> if (this._rewriteChunkInReasons === undefined) {
<ide> this._rewriteChunkInReasons = [];
<add> }
<ide> this._rewriteChunkInReasons.push({
<ide> oldChunk,
<ide> newChunks
<ide> class Module extends DependenciesBlock {
<ide>
<ide> // Mangle export name if possible
<ide> if (this.isProvided(exportName)) {
<del> if (this.buildMeta.exportsType === "namespace")
<add> if (this.buildMeta.exportsType === "namespace") {
<ide> return Template.numberToIdentifer(idx);
<del> else if (
<add> }
<add> if (
<ide> this.buildMeta.exportsType === "named" &&
<ide> !this.usedExports.includes("default")
<del> )
<add> ) {
<ide> return Template.numberToIdentifer(idx);
<add> }
<ide> }
<ide> return exportName;
<ide> }
<ide><path>lib/ModuleFilenameHelpers.js
<ide> const getHash = str => {
<ide> };
<ide>
<ide> const asRegExp = test => {
<del> if (typeof test === "string")
<add> if (typeof test === "string") {
<ide> test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
<add> }
<ide> return test;
<ide> };
<ide>
<ide> ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
<ide> if (countMap[item].length > 1) {
<ide> if (comparator && countMap[item][0] === i) return item;
<ide> return fn(item, i, posMap[item]++);
<del> } else return item;
<add> } else {
<add> return item;
<add> }
<ide> });
<ide> };
<ide>
<ide> ModuleFilenameHelpers.matchPart = (str, test) => {
<ide> };
<ide>
<ide> ModuleFilenameHelpers.matchObject = (obj, str) => {
<del> if (obj.test)
<del> if (!ModuleFilenameHelpers.matchPart(str, obj.test)) return false;
<del> if (obj.include)
<del> if (!ModuleFilenameHelpers.matchPart(str, obj.include)) return false;
<del> if (obj.exclude)
<del> if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) return false;
<add> if (obj.test) {
<add> if (!ModuleFilenameHelpers.matchPart(str, obj.test)) {
<add> return false;
<add> }
<add> }
<add> if (obj.include) {
<add> if (!ModuleFilenameHelpers.matchPart(str, obj.include)) {
<add> return false;
<add> }
<add> }
<add> if (obj.exclude) {
<add> if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) {
<add> return false;
<add> }
<add> }
<ide> return true;
<ide> };
<ide><path>lib/MultiCompiler.js
<ide> module.exports = class MultiCompiler extends Tapable {
<ide> for (const c of list) {
<ide> const ready =
<ide> !c.dependencies || c.dependencies.every(isDependencyFulfilled);
<del> if (ready) readyCompilers.push(c);
<del> else remainingCompilers.push(c);
<add> if (ready) {
<add> readyCompilers.push(c);
<add> } else {
<add> remainingCompilers.push(c);
<add> }
<ide> }
<ide> return readyCompilers;
<ide> };
<ide> module.exports = class MultiCompiler extends Tapable {
<ide> }
<ide>
<ide> run(callback) {
<del> if (this.running) return callback(new ConcurrentCompilationError());
<add> if (this.running) {
<add> return callback(new ConcurrentCompilationError());
<add> }
<ide>
<ide> const finalCallback = (err, stats) => {
<ide> this.running = false;
<ide>
<del> if (callback !== undefined) return callback(err, stats);
<add> if (callback !== undefined) {
<add> return callback(err, stats);
<add> }
<ide> };
<ide>
<ide> const allStats = this.compilers.map(() => null);
<ide> module.exports = class MultiCompiler extends Tapable {
<ide> (compiler, callback) => {
<ide> const compilerIdx = this.compilers.indexOf(compiler);
<ide> compiler.run((err, stats) => {
<del> if (err) return callback(err);
<add> if (err) {
<add> return callback(err);
<add> }
<ide> allStats[compilerIdx] = stats;
<ide> callback();
<ide> });
<ide> },
<ide> err => {
<del> if (err) return finalCallback(err);
<add> if (err) {
<add> return finalCallback(err);
<add> }
<ide> finalCallback(null, new MultiStats(allStats));
<ide> }
<ide> );
<ide> module.exports = class MultiCompiler extends Tapable {
<ide>
<ide> purgeInputFileSystem() {
<ide> for (const compiler of this.compilers) {
<del> if (compiler.inputFileSystem && compiler.inputFileSystem.purge)
<add> if (compiler.inputFileSystem && compiler.inputFileSystem.purge) {
<ide> compiler.inputFileSystem.purge();
<add> }
<ide> }
<ide> }
<ide> };
<ide><path>lib/MultiModule.js
<ide> class MultiModule extends Module {
<ide> let idx = 0;
<ide> for (const dep of this.dependencies) {
<ide> if (dep.module) {
<del> if (idx === this.dependencies.length - 1) str.push("module.exports = ");
<add> if (idx === this.dependencies.length - 1) {
<add> str.push("module.exports = ");
<add> }
<ide> str.push("__webpack_require__(");
<del> if (runtimeTemplate.outputOptions.pathinfo)
<add> if (runtimeTemplate.outputOptions.pathinfo) {
<ide> str.push(Template.toComment(dep.request));
<add> }
<ide> str.push(`${JSON.stringify(dep.module.id)}`);
<ide> str.push(")");
<ide> } else {
<ide><path>lib/NodeStuffPlugin.js
<ide> class NodeStuffPlugin {
<ide> if (parserOptions.node === false) return;
<ide>
<ide> let localOptions = options;
<del> if (parserOptions.node)
<add> if (parserOptions.node) {
<ide> localOptions = Object.assign({}, localOptions, parserOptions.node);
<add> }
<ide>
<ide> const setConstant = (expressionName, value) => {
<ide> parser.hooks.expression
<ide><path>lib/NormalModule.js
<ide> class NormalModule extends Module {
<ide> const loaderContext = {
<ide> version: 2,
<ide> emitWarning: warning => {
<del> if (!(warning instanceof Error))
<add> if (!(warning instanceof Error)) {
<ide> warning = new NonErrorEmittedError(warning);
<add> }
<ide> this.warnings.push(new ModuleWarning(this, warning));
<ide> },
<ide> emitError: error => {
<del> if (!(error instanceof Error)) error = new NonErrorEmittedError(error);
<add> if (!(error instanceof Error)) {
<add> error = new NonErrorEmittedError(error);
<add> }
<ide> this.errors.push(new ModuleError(this, error));
<ide> },
<ide> exec: (code, filename) => {
<ide> class NormalModule extends Module {
<ide> resolver.resolve({}, context, request, {}, callback);
<ide> },
<ide> emitFile: (name, content, sourceMap) => {
<del> if (!this.buildInfo.assets) this.buildInfo.assets = Object.create(null);
<add> if (!this.buildInfo.assets) {
<add> this.buildInfo.assets = Object.create(null);
<add> }
<ide> this.buildInfo.assets[name] = this.createSourceForAsset(
<ide> name,
<ide> content,
<ide> class NormalModule extends Module {
<ide> };
<ide>
<ide> compilation.hooks.normalModuleLoader.call(loaderContext, this);
<del> if (options.loader) Object.assign(loaderContext, options.loader);
<add> if (options.loader) {
<add> Object.assign(loaderContext, options.loader);
<add> }
<ide>
<ide> return loaderContext;
<ide> }
<ide><path>lib/NormalModuleFactory.js
<ide> const cachedMerge = require("./util/cachedMerge");
<ide> const EMPTY_RESOLVE_OPTIONS = {};
<ide>
<ide> const loaderToIdent = data => {
<del> if (!data.options) return data.loader;
<del> if (typeof data.options === "string") return data.loader + "?" + data.options;
<del> if (typeof data.options !== "object")
<add> if (!data.options) {
<add> return data.loader;
<add> }
<add> if (typeof data.options === "string") {
<add> return data.loader + "?" + data.options;
<add> }
<add> if (typeof data.options !== "object") {
<ide> throw new Error("loader options must be string or object");
<del> if (data.ident) return data.loader + "??" + data.ident;
<add> }
<add> if (data.ident) {
<add> return data.loader + "??" + data.ident;
<add> }
<ide> return data.loader + "?" + JSON.stringify(data.options);
<ide> };
<ide>
<ide> class NormalModuleFactory extends Tapable {
<ide> const useLoadersPre = [];
<ide> for (const r of result) {
<ide> if (r.type === "use") {
<del> if (r.enforce === "post" && !noPrePostAutoLoaders)
<add> if (r.enforce === "post" && !noPrePostAutoLoaders) {
<ide> useLoadersPost.push(r.value);
<del> else if (
<add> } else if (
<ide> r.enforce === "pre" &&
<ide> !noPreAutoLoaders &&
<ide> !noPrePostAutoLoaders
<del> )
<add> ) {
<ide> useLoadersPre.push(r.value);
<del> else if (!r.enforce && !noAutoLoaders && !noPrePostAutoLoaders)
<add> } else if (
<add> !r.enforce &&
<add> !noAutoLoaders &&
<add> !noPrePostAutoLoaders
<add> ) {
<ide> useLoaders.push(r.value);
<add> }
<ide> } else if (
<ide> typeof r.value === "object" &&
<ide> r.value !== null &&
<ide> class NormalModuleFactory extends Tapable {
<ide> getParser(type, parserOptions) {
<ide> let ident = type;
<ide> if (parserOptions) {
<del> if (parserOptions.ident) ident = `${type}|${parserOptions.ident}`;
<del> else ident = JSON.stringify([type, parserOptions]);
<add> if (parserOptions.ident) {
<add> ident = `${type}|${parserOptions.ident}`;
<add> } else {
<add> ident = JSON.stringify([type, parserOptions]);
<add> }
<ide> }
<ide> if (ident in this.parserCache) {
<ide> return this.parserCache[ident];
<ide> class NormalModuleFactory extends Tapable {
<ide> getGenerator(type, generatorOptions) {
<ide> let ident = type;
<ide> if (generatorOptions) {
<del> if (generatorOptions.ident) ident = `${type}|${generatorOptions.ident}`;
<del> else ident = JSON.stringify([type, generatorOptions]);
<add> if (generatorOptions.ident) {
<add> ident = `${type}|${generatorOptions.ident}`;
<add> } else {
<add> ident = JSON.stringify([type, generatorOptions]);
<add> }
<ide> }
<ide> if (ident in this.generatorCache) {
<ide> return this.generatorCache[ident];
<ide><path>lib/OptionsDefaulter.js
<ide> class OptionsDefaulter {
<ide> for (let name in this.defaults) {
<ide> switch (this.config[name]) {
<ide> case undefined:
<del> if (getProperty(options, name) === undefined)
<add> if (getProperty(options, name) === undefined) {
<ide> setProperty(options, name, this.defaults[name]);
<add> }
<ide> break;
<ide> case "call":
<ide> setProperty(
<ide> class OptionsDefaulter {
<ide> );
<ide> break;
<ide> case "make":
<del> if (getProperty(options, name) === undefined)
<add> if (getProperty(options, name) === undefined) {
<ide> setProperty(options, name, this.defaults[name].call(this, options));
<add> }
<ide> break;
<ide> case "append": {
<ide> let oldValue = getProperty(options, name);
<del> if (!Array.isArray(oldValue)) oldValue = [];
<add> if (!Array.isArray(oldValue)) {
<add> oldValue = [];
<add> }
<ide> oldValue.push(...this.defaults[name]);
<ide> setProperty(options, name, oldValue);
<ide> break;
<ide><path>lib/Parser.js
<ide> class Parser extends Tapable {
<ide> const regexp = HOOK_MAP_COMPAT_CONFIG[name];
<ide> const match = regexp.exec(options.name);
<ide> if (match) {
<del> if (match[1])
<add> if (match[1]) {
<ide> this.hooks[name].tap(
<ide> match[1],
<ide> options.fn.name || "unnamed compat plugin",
<ide> options.fn.bind(this)
<ide> );
<del> else
<add> } else {
<ide> this.hooks[name].tap(
<ide> options.fn.name || "unnamed compat plugin",
<ide> options.fn.bind(this)
<ide> );
<add> }
<ide> return true;
<ide> }
<ide> }
<ide> class Parser extends Tapable {
<ide> .setBoolean(expr.value)
<ide> .setRange(expr.range);
<ide> }
<del> if (expr.value === null)
<add> if (expr.value === null) {
<ide> return new BasicEvaluatedExpression().setNull().setRange(expr.range);
<del> if (expr.value instanceof RegExp)
<add> }
<add> if (expr.value instanceof RegExp) {
<ide> return new BasicEvaluatedExpression()
<ide> .setRegExp(expr.value)
<ide> .setRange(expr.range);
<add> }
<ide> });
<ide> this.hooks.evaluate.for("LogicalExpression").tap("Parser", expr => {
<ide> let left;
<ide> class Parser extends Tapable {
<ide> .setRange(expr.range);
<ide> }
<ide> const arg = this.evaluateExpression(expr.argument);
<del> if (arg.isString() || arg.isWrapped())
<add> if (arg.isString() || arg.isWrapped()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setString("string")
<ide> .setRange(expr.range);
<del> else if (arg.isNumber())
<add> }
<add> if (arg.isNumber()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setString("number")
<ide> .setRange(expr.range);
<del> else if (arg.isBoolean())
<add> }
<add> if (arg.isBoolean()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setString("boolean")
<ide> .setRange(expr.range);
<del> else if (arg.isArray() || arg.isConstArray() || arg.isRegExp())
<add> }
<add> if (arg.isArray() || arg.isConstArray() || arg.isRegExp()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setString("object")
<ide> .setRange(expr.range);
<add> }
<ide> } else if (expr.operator === "!") {
<ide> const argument = this.evaluateExpression(expr.argument);
<ide> if (!argument) return;
<ide> if (argument.isBoolean()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setBoolean(!argument.bool)
<ide> .setRange(expr.range);
<del> } else if (argument.isTruthy()) {
<add> }
<add> if (argument.isTruthy()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setBoolean(false)
<ide> .setRange(expr.range);
<del> } else if (argument.isFalsy()) {
<add> }
<add> if (argument.isFalsy()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setBoolean(true)
<ide> .setRange(expr.range);
<del> } else if (argument.isString()) {
<add> }
<add> if (argument.isString()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setBoolean(!argument.string)
<ide> .setRange(expr.range);
<del> } else if (argument.isNumber()) {
<add> }
<add> if (argument.isNumber()) {
<ide> return new BasicEvaluatedExpression()
<ide> .setBoolean(!argument.number)
<ide> .setRange(expr.range);
<ide> class Parser extends Tapable {
<ide> result = param.string.split(arg.string);
<ide> } else if (arg.isRegExp()) {
<ide> result = param.string.split(arg.regExp);
<del> } else return;
<add> } else {
<add> return;
<add> }
<ide> return new BasicEvaluatedExpression()
<ide> .setArray(result)
<ide> .setRange(expr.range);
<ide> class Parser extends Tapable {
<ide> const alternate = this.evaluateExpression(expr.alternate);
<ide> if (!consequent || !alternate) return;
<ide> res = new BasicEvaluatedExpression();
<del> if (consequent.isConditional()) res.setOptions(consequent.options);
<del> else res.setOptions([consequent]);
<del> if (alternate.isConditional()) res.addOptions(alternate.options);
<del> else res.addOptions([alternate]);
<add> if (consequent.isConditional()) {
<add> res.setOptions(consequent.options);
<add> } else {
<add> res.setOptions([consequent]);
<add> }
<add> if (alternate.isConditional()) {
<add> res.addOptions(alternate.options);
<add> } else {
<add> res.addOptions([alternate]);
<add> }
<ide> } else {
<ide> res = this.evaluateExpression(
<ide> conditionValue ? expr.consequent : expr.alternate
<ide> class Parser extends Tapable {
<ide>
<ide> getRenameIdentifier(expr) {
<ide> const result = this.evaluateExpression(expr);
<del> if (!result) return;
<del> if (result.isIdentifier()) return result.identifier;
<del> return;
<add> if (result && result.isIdentifier()) {
<add> return result.identifier;
<add> }
<ide> }
<ide>
<ide> walkClass(classy) {
<ide> class Parser extends Tapable {
<ide> const wasTopLevel = this.scope.topLevelScope;
<ide> this.scope.topLevelScope = false;
<ide> for (const methodDefinition of classy.body.body) {
<del> if (methodDefinition.type === "MethodDefinition")
<add> if (methodDefinition.type === "MethodDefinition") {
<ide> this.walkMethodDefinition(methodDefinition);
<add> }
<ide> }
<ide> this.scope.topLevelScope = wasTopLevel;
<ide> }
<ide> }
<ide>
<ide> walkMethodDefinition(methodDefinition) {
<del> if (methodDefinition.computed && methodDefinition.key)
<add> if (methodDefinition.computed && methodDefinition.key) {
<ide> this.walkExpression(methodDefinition.key);
<del> if (methodDefinition.value) this.walkExpression(methodDefinition.value);
<add> }
<add> if (methodDefinition.value) {
<add> this.walkExpression(methodDefinition.value);
<add> }
<ide> }
<ide>
<ide> // Prewalking iterates the scope for variable declarations
<ide> class Parser extends Tapable {
<ide>
<ide> prewalkIfStatement(statement) {
<ide> this.prewalkStatement(statement.consequent);
<del> if (statement.alternate) this.prewalkStatement(statement.alternate);
<add> if (statement.alternate) {
<add> this.prewalkStatement(statement.alternate);
<add> }
<ide> }
<ide>
<ide> walkIfStatement(statement) {
<ide> const result = this.hooks.statementIf.call(statement);
<ide> if (result === undefined) {
<ide> this.walkExpression(statement.test);
<ide> this.walkStatement(statement.consequent);
<del> if (statement.alternate) this.walkStatement(statement.alternate);
<add> if (statement.alternate) {
<add> this.walkStatement(statement.alternate);
<add> }
<ide> } else {
<del> if (result) this.walkStatement(statement.consequent);
<del> else if (statement.alternate) this.walkStatement(statement.alternate);
<add> if (result) {
<add> this.walkStatement(statement.consequent);
<add> } else if (statement.alternate) {
<add> this.walkStatement(statement.alternate);
<add> }
<ide> }
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide>
<ide> prewalkForStatement(statement) {
<ide> if (statement.init) {
<del> if (statement.init.type === "VariableDeclaration")
<add> if (statement.init.type === "VariableDeclaration") {
<ide> this.prewalkStatement(statement.init);
<add> }
<ide> }
<ide> this.prewalkStatement(statement.body);
<ide> }
<ide>
<ide> walkForStatement(statement) {
<ide> if (statement.init) {
<del> if (statement.init.type === "VariableDeclaration")
<add> if (statement.init.type === "VariableDeclaration") {
<ide> this.walkStatement(statement.init);
<del> else this.walkExpression(statement.init);
<add> } else {
<add> this.walkExpression(statement.init);
<add> }
<add> }
<add> if (statement.test) {
<add> this.walkExpression(statement.test);
<add> }
<add> if (statement.update) {
<add> this.walkExpression(statement.update);
<ide> }
<del> if (statement.test) this.walkExpression(statement.test);
<del> if (statement.update) this.walkExpression(statement.update);
<ide> this.walkStatement(statement.body);
<ide> }
<ide>
<ide> prewalkForInStatement(statement) {
<del> if (statement.left.type === "VariableDeclaration")
<add> if (statement.left.type === "VariableDeclaration") {
<ide> this.prewalkVariableDeclaration(statement.left);
<add> }
<ide> this.prewalkStatement(statement.body);
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide> switch (specifier.type) {
<ide> case "ExportSpecifier": {
<ide> const name = specifier.exported.name;
<del> if (source)
<add> if (source) {
<ide> this.hooks.exportImportSpecifier.call(
<ide> statement,
<ide> source,
<ide> specifier.local.name,
<ide> name,
<ide> specifierIndex
<ide> );
<del> else
<add> } else {
<ide> this.hooks.exportSpecifier.call(
<ide> statement,
<ide> specifier.local.name,
<ide> name,
<ide> specifierIndex
<ide> );
<add> }
<ide> break;
<ide> }
<ide> }
<ide> class Parser extends Tapable {
<ide> }
<ide>
<ide> walkArrayExpression(expression) {
<del> if (expression.elements) this.walkExpressions(expression.elements);
<add> if (expression.elements) {
<add> this.walkExpressions(expression.elements);
<add> }
<ide> }
<ide>
<ide> walkSpreadElement(expression) {
<del> if (expression.argument) this.walkExpression(expression.argument);
<add> if (expression.argument) {
<add> this.walkExpression(expression.argument);
<add> }
<ide> }
<ide>
<ide> walkObjectExpression(expression) {
<ide> class Parser extends Tapable {
<ide> this.walkExpression(prop.argument);
<ide> continue;
<ide> }
<del> if (prop.computed) this.walkExpression(prop.key);
<del> if (prop.shorthand) this.scope.inShorthand = true;
<add> if (prop.computed) {
<add> this.walkExpression(prop.key);
<add> }
<add> if (prop.shorthand) {
<add> this.scope.inShorthand = true;
<add> }
<ide> this.walkExpression(prop.value);
<del> if (prop.shorthand) this.scope.inShorthand = false;
<add> if (prop.shorthand) {
<add> this.scope.inShorthand = false;
<add> }
<ide> }
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide> if (result === undefined) {
<ide> this.walkExpression(expression.test);
<ide> this.walkExpression(expression.consequent);
<del> if (expression.alternate) this.walkExpression(expression.alternate);
<add> if (expression.alternate) {
<add> this.walkExpression(expression.alternate);
<add> }
<ide> } else {
<del> if (result) this.walkExpression(expression.consequent);
<del> else if (expression.alternate) this.walkExpression(expression.alternate);
<add> if (result) {
<add> this.walkExpression(expression.consequent);
<add> } else if (expression.alternate) {
<add> this.walkExpression(expression.alternate);
<add> }
<ide> }
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide> }
<ide>
<ide> this.walkExpression(expression.callee);
<del> if (expression.arguments) this.walkExpressions(expression.arguments);
<add> if (expression.arguments) {
<add> this.walkExpressions(expression.arguments);
<add> }
<ide> }
<ide>
<ide> walkYieldExpression(expression) {
<del> if (expression.argument) this.walkExpression(expression.argument);
<add> if (expression.argument) {
<add> this.walkExpression(expression.argument);
<add> }
<ide> }
<ide>
<ide> walkTemplateLiteral(expression) {
<del> if (expression.expressions) this.walkExpressions(expression.expressions);
<add> if (expression.expressions) {
<add> this.walkExpressions(expression.expressions);
<add> }
<ide> }
<ide>
<ide> walkTaggedTemplateExpression(expression) {
<del> if (expression.tag) this.walkExpression(expression.tag);
<del> if (expression.quasi && expression.quasi.expressions)
<add> if (expression.tag) {
<add> this.walkExpression(expression.tag);
<add> }
<add> if (expression.quasi && expression.quasi.expressions) {
<ide> this.walkExpressions(expression.quasi.expressions);
<add> }
<ide> }
<ide>
<ide> walkClassExpression(expression) {
<ide> class Parser extends Tapable {
<ide> const hook = this.hooks.canRename.get(renameIdentifier);
<ide> if (hook !== undefined && hook.call(argOrThis)) {
<ide> const hook = this.hooks.rename.get(renameIdentifier);
<del> if (hook === undefined || !hook.call(argOrThis))
<add> if (hook === undefined || !hook.call(argOrThis)) {
<ide> return renameIdentifier;
<add> }
<ide> }
<ide> }
<ide> this.walkExpression(argOrThis);
<ide> class Parser extends Tapable {
<ide> parseString(expression) {
<ide> switch (expression.type) {
<ide> case "BinaryExpression":
<del> if (expression.operator === "+")
<add> if (expression.operator === "+") {
<ide> return (
<ide> this.parseString(expression.left) +
<ide> this.parseString(expression.right)
<ide> );
<add> }
<ide> break;
<ide> case "Literal":
<ide> return expression.value + "";
<ide> class Parser extends Tapable {
<ide> const consequent = this.parseCalculatedString(expression.consequent);
<ide> const alternate = this.parseCalculatedString(expression.alternate);
<ide> const items = [];
<del> if (consequent.conditional) items.push(...consequent.conditional);
<del> else if (!consequent.code) items.push(consequent);
<del> else break;
<del> if (alternate.conditional) items.push(...alternate.conditional);
<del> else if (!alternate.code) items.push(alternate);
<del> else break;
<add> if (consequent.conditional) {
<add> items.push(...consequent.conditional);
<add> } else if (!consequent.code) {
<add> items.push(consequent);
<add> } else {
<add> break;
<add> }
<add> if (alternate.conditional) {
<add> items.push(...alternate.conditional);
<add> } else if (!alternate.code) {
<add> items.push(alternate);
<add> } else {
<add> break;
<add> }
<ide> return {
<ide> range: undefined,
<ide> value: "",
<ide> class Parser extends Tapable {
<ide> sourceType: this.sourceType,
<ide> locations: false
<ide> });
<del> if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement")
<add> if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") {
<ide> throw new Error("evaluate: Source is not a expression");
<add> }
<ide> return this.evaluateExpression(ast.body[0].expression);
<ide> }
<ide>
<ide> class Parser extends Tapable {
<ide> return null;
<ide> }
<ide> let prefix = "";
<del> for (let i = exprName.length - 1; i >= 2; i--) prefix += exprName[i] + ".";
<del> if (exprName.length > 1) prefix += exprName[1];
<add> for (let i = exprName.length - 1; i >= 2; i--) {
<add> prefix += exprName[i] + ".";
<add> }
<add> if (exprName.length > 1) {
<add> prefix += exprName[1];
<add> }
<ide> const name = prefix ? prefix + "." + exprName[0] : exprName[0];
<ide> const nameGeneral = prefix;
<ide> return {
<ide><path>lib/ParserHelpers.js
<ide> ParserHelpers.evaluateToIdentifier = (identifier, truthy) => {
<ide> let evex = new BasicEvaluatedExpression()
<ide> .setIdentifier(identifier)
<ide> .setRange(expr.range);
<del> if (truthy === true) evex = evex.setTruthy();
<del> else if (truthy === false) evex = evex.setFalsy();
<add> if (truthy === true) {
<add> evex = evex.setTruthy();
<add> } else if (truthy === false) {
<add> evex = evex.setFalsy();
<add> }
<ide> return evex;
<ide> };
<ide> };
<ide><path>lib/RawModule.js
<ide> module.exports = class RawModule extends Module {
<ide> }
<ide>
<ide> source() {
<del> if (this.useSourceMap)
<add> if (this.useSourceMap) {
<ide> return new OriginalSource(this.sourceStr, this.identifier());
<del> else return new RawSource(this.sourceStr);
<add> } else {
<add> return new RawSource(this.sourceStr);
<add> }
<ide> }
<ide>
<ide> updateHash(hash) {
<ide><path>lib/RecordIdsPlugin.js
<ide> class RecordIdsPlugin {
<ide> module.id = id;
<ide> }
<ide> }
<del> if (Array.isArray(records.modules.usedIds))
<add> if (Array.isArray(records.modules.usedIds)) {
<ide> compilation.usedModuleIds = new Set(records.modules.usedIds);
<add> }
<ide> }
<ide> );
<ide>
<ide> const getModuleIdentifier = module => {
<del> if (portableIds)
<add> if (portableIds) {
<ide> return identifierUtils.makePathsRelative(
<ide> compiler.context,
<ide> module.identifier(),
<ide> compilation.cache
<ide> );
<add> }
<ide> return module.identifier();
<ide> };
<ide>
<ide> class RecordIdsPlugin {
<ide> const index = chunkGroup.chunks.indexOf(chunk);
<ide> for (const origin of chunkGroup.origins) {
<ide> if (origin.module) {
<del> if (origin.request)
<add> if (origin.request) {
<ide> sources.push(
<ide> `${index} ${getModuleIdentifier(origin.module)} ${
<ide> origin.request
<ide> }`
<ide> );
<del> else if (typeof origin.loc === "string")
<add> } else if (typeof origin.loc === "string") {
<ide> sources.push(
<ide> `${index} ${getModuleIdentifier(origin.module)} ${origin.loc}`
<ide> );
<del> else if (
<add> } else if (
<ide> origin.loc &&
<ide> typeof origin.loc === "object" &&
<ide> origin.loc.start
<del> )
<add> ) {
<ide> sources.push(
<ide> `${index} ${getModuleIdentifier(
<ide> origin.module
<ide> )} ${JSON.stringify(origin.loc.start)}`
<ide> );
<add> }
<ide> }
<ide> }
<ide> }
<ide> class RecordIdsPlugin {
<ide> }
<ide> }
<ide> }
<del> if (Array.isArray(records.chunks.usedIds))
<add> if (Array.isArray(records.chunks.usedIds)) {
<ide> compilation.usedChunkIds = new Set(records.chunks.usedIds);
<add> }
<ide> }
<ide> );
<ide> });
<ide><path>lib/RequestShortener.js
<ide> const createRegExpForPath = path => {
<ide> class RequestShortener {
<ide> constructor(directory) {
<ide> directory = normalizeBackSlashDirection(directory);
<del> if (SEPARATOR_REGEXP.test(directory))
<add> if (SEPARATOR_REGEXP.test(directory)) {
<ide> directory = directory.substr(0, directory.length - 1);
<add> }
<ide>
<ide> if (directory) {
<ide> this.currentDirectoryRegExp = createRegExpForPath(directory);
<ide> class RequestShortener {
<ide> shorten(request) {
<ide> if (!request) return request;
<ide> const cacheEntry = this.cache.get(request);
<del> if (cacheEntry !== undefined) return cacheEntry;
<add> if (cacheEntry !== undefined) {
<add> return cacheEntry;
<add> }
<ide> let result = normalizeBackSlashDirection(request);
<del> if (this.buildinsAsModule && this.buildinsRegExp)
<add> if (this.buildinsAsModule && this.buildinsRegExp) {
<ide> result = result.replace(this.buildinsRegExp, "!(webpack)");
<del> if (this.currentDirectoryRegExp)
<add> }
<add> if (this.currentDirectoryRegExp) {
<ide> result = result.replace(this.currentDirectoryRegExp, "!.");
<del> if (this.parentDirectoryRegExp)
<add> }
<add> if (this.parentDirectoryRegExp) {
<ide> result = result.replace(this.parentDirectoryRegExp, "!..");
<del> if (!this.buildinsAsModule && this.buildinsRegExp)
<add> }
<add> if (!this.buildinsAsModule && this.buildinsRegExp) {
<ide> result = result.replace(this.buildinsRegExp, "!(webpack)");
<add> }
<ide> result = result.replace(INDEX_JS_REGEXP, "$1");
<ide> result = result.replace(FRONT_OR_BACK_BANG_REGEXP, "");
<ide> this.cache.set(request, result);
<ide><path>lib/RuleSet.js
<ide> module.exports = class RuleSet {
<ide> }
<ide>
<ide> static normalizeRule(rule, refs, ident) {
<del> if (typeof rule === "string")
<add> if (typeof rule === "string") {
<ide> return {
<ide> use: [
<ide> {
<ide> loader: rule
<ide> }
<ide> ]
<ide> };
<del> if (!rule)
<add> }
<add> if (!rule) {
<ide> throw new Error("Unexcepted null when object was expected as rule");
<del> if (typeof rule !== "object")
<add> }
<add> if (typeof rule !== "object") {
<ide> throw new Error(
<ide> "Unexcepted " +
<ide> typeof rule +
<ide> " when object was expected as rule (" +
<ide> rule +
<ide> ")"
<ide> );
<add> }
<ide>
<ide> const newRule = {};
<ide> let useSource;
<ide> let resourceSource;
<ide> let condition;
<ide>
<ide> const checkUseSource = newSource => {
<del> if (useSource && useSource !== newSource)
<add> if (useSource && useSource !== newSource) {
<ide> throw new Error(
<ide> RuleSet.buildErrorMessage(
<ide> rule,
<ide> module.exports = class RuleSet {
<ide> )
<ide> )
<ide> );
<add> }
<ide> useSource = newSource;
<ide> };
<ide>
<ide> const checkResourceSource = newSource => {
<del> if (resourceSource && resourceSource !== newSource)
<add> if (resourceSource && resourceSource !== newSource) {
<ide> throw new Error(
<ide> RuleSet.buildErrorMessage(
<ide> rule,
<ide> module.exports = class RuleSet {
<ide> )
<ide> )
<ide> );
<add> }
<ide> resourceSource = newSource;
<ide> };
<ide>
<ide> module.exports = class RuleSet {
<ide> }
<ide> }
<ide>
<del> if (rule.loader && rule.loaders)
<add> if (rule.loader && rule.loaders) {
<ide> throw new Error(
<ide> RuleSet.buildErrorMessage(
<ide> rule,
<ide> module.exports = class RuleSet {
<ide> )
<ide> )
<ide> );
<add> }
<ide>
<ide> const loader = rule.loaders || rule.loader;
<ide> if (typeof loader === "string" && !rule.options && !rule.query) {
<ide> module.exports = class RuleSet {
<ide> newRule.use = RuleSet.normalizeUse(rule.use, ident);
<ide> }
<ide>
<del> if (rule.rules)
<add> if (rule.rules) {
<ide> newRule.rules = RuleSet.normalizeRules(
<ide> rule.rules,
<ide> refs,
<ide> `${ident}-rules`
<ide> );
<add> }
<ide>
<del> if (rule.oneOf)
<add> if (rule.oneOf) {
<ide> newRule.oneOf = RuleSet.normalizeRules(
<ide> rule.oneOf,
<ide> refs,
<ide> `${ident}-oneOf`
<ide> );
<add> }
<ide>
<ide> const keys = Object.keys(rule).filter(key => {
<ide> return ![
<ide> module.exports = class RuleSet {
<ide>
<ide> const newItem = {};
<ide>
<del> if (item.options && item.query)
<add> if (item.options && item.query) {
<ide> throw new Error("Provided options and query in use");
<add> }
<ide>
<del> if (!item.loader) throw new Error("No loader specified");
<add> if (!item.loader) {
<add> throw new Error("No loader specified");
<add> }
<ide>
<ide> newItem.options = item.options || item.query;
<ide>
<ide> if (typeof newItem.options === "object" && newItem.options) {
<del> if (newItem.options.ident) newItem.ident = newItem.options.ident;
<del> else newItem.ident = ident;
<add> if (newItem.options.ident) {
<add> newItem.ident = newItem.options.ident;
<add> } else {
<add> newItem.ident = ident;
<add> }
<ide> }
<ide>
<ide> const keys = Object.keys(item).filter(function(key) {
<ide> module.exports = class RuleSet {
<ide> const items = condition.map(c => RuleSet.normalizeCondition(c));
<ide> return orMatcher(items);
<ide> }
<del> if (typeof condition !== "object")
<add> if (typeof condition !== "object") {
<ide> throw Error(
<ide> "Unexcepted " +
<ide> typeof condition +
<ide> " when condition was expected (" +
<ide> condition +
<ide> ")"
<ide> );
<add> }
<ide>
<ide> const matchers = [];
<ide> Object.keys(condition).forEach(key => {
<ide> module.exports = class RuleSet {
<ide> throw new Error("Unexcepted property " + key + " in condition");
<ide> }
<ide> });
<del> if (matchers.length === 0)
<add> if (matchers.length === 0) {
<ide> throw new Error("Excepted condition but got " + condition);
<del> if (matchers.length === 1) return matchers[0];
<add> }
<add> if (matchers.length === 1) {
<add> return matchers[0];
<add> }
<ide> return andMatcher(matchers);
<ide> }
<ide>
<ide> module.exports = class RuleSet {
<ide> data.resourceQuery &&
<ide> rule.resourceQuery &&
<ide> !rule.resourceQuery(data.resourceQuery)
<del> )
<add> ) {
<ide> return false;
<del> if (data.compiler && rule.compiler && !rule.compiler(data.compiler))
<add> }
<add> if (data.compiler && rule.compiler && !rule.compiler(data.compiler)) {
<ide> return false;
<add> }
<ide>
<ide> // apply
<ide> const keys = Object.keys(rule).filter(key => {
<ide> module.exports = class RuleSet {
<ide>
<ide> findOptionsByIdent(ident) {
<ide> const options = this.references[ident];
<del> if (!options)
<add> if (!options) {
<ide> throw new Error("Can't find options with ident '" + ident + "'");
<add> }
<ide> return options;
<ide> }
<ide> };
<ide><path>lib/RuntimeTemplate.js
<ide> module.exports = class RuntimeTemplate {
<ide> }
<ide>
<ide> moduleRaw({ module, request }) {
<del> if (!module)
<add> if (!module) {
<ide> return this.missingModule({
<ide> request
<ide> });
<add> }
<ide> return `__webpack_require__(${this.moduleId({ module, request })})`;
<ide> }
<ide>
<ide> module.exports = class RuntimeTemplate {
<ide> }
<ide>
<ide> moduleNamespace({ module, request, strict }) {
<del> if (!module)
<add> if (!module) {
<ide> return this.missingModule({
<ide> request
<ide> });
<add> }
<ide> const moduleId = this.moduleId({
<ide> module,
<ide> request
<ide> module.exports = class RuntimeTemplate {
<ide> content += `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/__webpack_require__.n(${importVar});\n`;
<ide> }
<ide> if (exportsType === "named") {
<del> if (Array.isArray(module.buildMeta.providedExports))
<add> if (Array.isArray(module.buildMeta.providedExports)) {
<ide> content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/__webpack_require__.t(${moduleId}, 1);\n`;
<del> else
<add> } else {
<ide> content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/__webpack_require__.t(${moduleId});\n`;
<add> }
<ide> }
<ide> return content;
<ide> }
<ide> module.exports = class RuntimeTemplate {
<ide> callContext,
<ide> importVar
<ide> }) {
<del> if (!module)
<add> if (!module) {
<ide> return this.missingModule({
<ide> request
<ide> });
<add> }
<ide> const exportsType = module.buildMeta && module.buildMeta.exportsType;
<ide>
<ide> if (!exportsType) {
<ide> if (exportName === "default") {
<ide> if (!originModule.buildMeta.strictHarmonyModule) {
<del> if (isCall) return `${importVar}_default()`;
<del> else if (asiSafe) return `(${importVar}_default())`;
<del> else return `${importVar}_default.a`;
<add> if (isCall) {
<add> return `${importVar}_default()`;
<add> } else if (asiSafe) {
<add> return `(${importVar}_default())`;
<add> } else {
<add> return `${importVar}_default.a`;
<add> }
<ide> } else {
<ide> return importVar;
<ide> }
<ide> module.exports = class RuntimeTemplate {
<ide> used !== exportName ? Template.toNormalComment(exportName) + " " : "";
<ide> const access = `${importVar}[${comment}${JSON.stringify(used)}]`;
<ide> if (isCall) {
<del> if (callContext === false && asiSafe) return `(0,${access})`;
<del> else if (callContext === false) return `Object(${access})`;
<add> if (callContext === false && asiSafe) {
<add> return `(0,${access})`;
<add> } else if (callContext === false) {
<add> return `Object(${access})`;
<add> }
<ide> }
<ide> return access;
<ide> } else {
<ide><path>lib/SourceMapDevToolPlugin.js
<ide> const getTaskForFile = (file, chunk, options, compilation) => {
<ide>
<ide> class SourceMapDevToolPlugin {
<ide> constructor(options) {
<del> if (arguments.length > 1)
<add> if (arguments.length > 1) {
<ide> throw new Error(
<ide> "SourceMapDevToolPlugin only takes one argument (pass an options object)"
<ide> );
<add> }
<ide>
<ide> validateOptions(schema, options || {}, "SourceMap DevTool Plugin");
<ide>
<ide><path>lib/Stats.js
<ide> class Stats {
<ide> ); // eslint-disable-line no-useless-escape
<ide> return ident => regExp.test(ident);
<ide> }
<del> if (item && typeof item === "object" && typeof item.test === "function")
<add> if (item && typeof item === "object" && typeof item.test === "function") {
<ide> return ident => item.test(ident);
<del> if (typeof item === "function") return item;
<del> if (typeof item === "boolean") return () => item;
<add> }
<add> if (typeof item === "function") {
<add> return item;
<add> }
<add> if (typeof item === "boolean") {
<add> return () => item;
<add> }
<ide> };
<ide>
<ide> const compilation = this.compilation;
<ide> class Stats {
<ide>
<ide> const formatError = e => {
<ide> let text = "";
<del> if (typeof e === "string")
<del> e = {
<del> message: e
<del> };
<add> if (typeof e === "string") {
<add> e = { message: e };
<add> }
<ide> if (e.chunk) {
<ide> text += `chunk ${e.chunk.name || e.chunk.id}${
<ide> e.chunk.hasRuntime()
<ide> class Stats {
<ide> );
<ide> }
<ide> text += e.message;
<del> if (showErrorDetails && e.details) text += `\n${e.details}`;
<del> if (showErrorDetails && e.missing)
<add> if (showErrorDetails && e.details) {
<add> text += `\n${e.details}`;
<add> }
<add> if (showErrorDetails && e.missing) {
<ide> text += e.missing.map(item => `\n[${item}]`).join("");
<add> }
<ide> if (showModuleTrace && e.origin) {
<ide> text += `\n @ ${e.origin.readableIdentifier(requestShortener)}`;
<ide> if (typeof e.originLoc === "object") {
<ide> class Stats {
<ide> }
<ide> if (chunk.name) {
<ide> assetsByFile[asset].chunkNames.push(chunk.name);
<del> if (obj.assetsByChunkName[chunk.name])
<add> if (obj.assetsByChunkName[chunk.name]) {
<ide> obj.assetsByChunkName[chunk.name] = []
<ide> .concat(obj.assetsByChunkName[chunk.name])
<ide> .concat([asset]);
<del> else obj.assetsByChunkName[chunk.name] = asset;
<add> } else {
<add> obj.assetsByChunkName[chunk.name] = asset;
<add> }
<ide> }
<ide> }
<ide> }
<ide> class Stats {
<ide> };
<ide> if (reason.dependency) {
<ide> const locInfo = formatLocation(reason.dependency.loc);
<del> if (locInfo) obj.loc = locInfo;
<add> if (locInfo) {
<add> obj.loc = locInfo;
<add> }
<ide> }
<ide> return obj;
<ide> })
<ide> .sort((a, b) => a.moduleId - b.moduleId);
<ide> }
<ide> if (showUsedExports) {
<del> if (module.used === true) obj.usedExports = module.usedExports;
<del> else if (module.used === false) obj.usedExports = false;
<add> if (module.used === true) {
<add> obj.usedExports = module.usedExports;
<add> } else if (module.used === false) {
<add> obj.usedExports = false;
<add> }
<ide> }
<ide> if (showProvidedExports) {
<ide> obj.providedExports = Array.isArray(module.buildMeta.providedExports)
<ide> class Stats {
<ide> const obj = new Stats(child).toJson(childOptions, forToString);
<ide> delete obj.hash;
<ide> delete obj.version;
<del> if (child.name)
<add> if (child.name) {
<ide> obj.name = identifierUtils.makePathsRelative(
<ide> context,
<ide> child.name,
<ide> compilation.cache
<ide> );
<add> }
<ide> return obj;
<ide> });
<ide> }
<ide> class Stats {
<ide> const rows = array.length;
<ide> const cols = array[0].length;
<ide> const colSizes = new Array(cols);
<del> for (let col = 0; col < cols; col++) colSizes[col] = 0;
<add> for (let col = 0; col < cols; col++) {
<add> colSizes[col] = 0;
<add> }
<ide> for (let row = 0; row < rows; row++) {
<ide> for (let col = 0; col < cols; col++) {
<ide> const value = `${getText(array, row, col)}`;
<ide> class Stats {
<ide> const format = array[row][col].color;
<ide> const value = `${getText(array, row, col)}`;
<ide> let l = value.length;
<del> if (align[col] === "l") format(value);
<del> for (; l < colSizes[col] && col !== cols - 1; l++) colors.normal(" ");
<del> if (align[col] === "r") format(value);
<del> if (col + 1 < cols && colSizes[col] !== 0)
<add> if (align[col] === "l") {
<add> format(value);
<add> }
<add> for (; l < colSizes[col] && col !== cols - 1; l++) {
<add> colors.normal(" ");
<add> }
<add> if (align[col] === "r") {
<add> format(value);
<add> }
<add> if (col + 1 < cols && colSizes[col] !== 0) {
<ide> colors.normal(splitter || " ");
<add> }
<ide> }
<ide> newline();
<ide> }
<ide> class Stats {
<ide> colors.magenta(" [prefetched]");
<ide> }
<ide> if (module.failed) colors.red(" [failed]");
<del> if (module.warnings)
<add> if (module.warnings) {
<ide> colors.yellow(
<ide> ` [${module.warnings} warning${module.warnings === 1 ? "" : "s"}]`
<ide> );
<del> if (module.errors)
<add> }
<add> if (module.errors) {
<ide> colors.red(
<ide> ` [${module.errors} error${module.errors === 1 ? "" : "s"}]`
<ide> );
<add> }
<ide> };
<ide>
<ide> const processModuleContent = (module, prefix) => {
<ide> if (Array.isArray(module.providedExports)) {
<ide> colors.normal(prefix);
<del> if (module.providedExports.length === 0) colors.cyan("[no exports]");
<del> else colors.cyan(`[exports: ${module.providedExports.join(", ")}]`);
<add> if (module.providedExports.length === 0) {
<add> colors.cyan("[no exports]");
<add> } else {
<add> colors.cyan(`[exports: ${module.providedExports.join(", ")}]`);
<add> }
<ide> newline();
<ide> }
<ide> if (module.usedExports !== undefined) {
<ide> class Stats {
<ide> );
<ide> }
<ide>
<del> while (buf[buf.length - 1] === "\n") buf.pop();
<add> while (buf[buf.length - 1] === "\n") {
<add> buf.pop();
<add> }
<ide> return buf.join("");
<ide> }
<ide>
<ide> class Stats {
<ide> static getChildOptions(options, idx) {
<ide> let innerOptions;
<ide> if (Array.isArray(options.children)) {
<del> if (idx < options.children.length) innerOptions = options.children[idx];
<add> if (idx < options.children.length) {
<add> innerOptions = options.children[idx];
<add> }
<ide> } else if (typeof options.children === "object" && options.children) {
<ide> innerOptions = options.children;
<ide> }
<del> if (typeof innerOptions === "boolean" || typeof innerOptions === "string")
<add> if (typeof innerOptions === "boolean" || typeof innerOptions === "string") {
<ide> innerOptions = Stats.presetToOptions(innerOptions);
<del> if (!innerOptions) return options;
<add> }
<add> if (!innerOptions) {
<add> return options;
<add> }
<ide> const childOptions = Object.assign({}, options);
<ide> delete childOptions.children; // do not inherit children
<ide> return Object.assign(childOptions, innerOptions);
<ide><path>lib/Template.js
<ide> class Template {
<ide> */
<ide> static numberToIdentifer(n) {
<ide> // lower case
<del> if (n < DELTA_A_TO_Z)
<add> if (n < DELTA_A_TO_Z) {
<ide> return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n);
<add> }
<ide>
<ide> // upper case
<ide> n -= DELTA_A_TO_Z;
<del> if (n < DELTA_A_TO_Z)
<add> if (n < DELTA_A_TO_Z) {
<ide> return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n);
<add> }
<ide>
<ide> // use multiple letters
<ide> return (
<ide><path>lib/TemplatedPathPlugin.js
<ide> const getReplacer = (value, allowEmpty) => {
<ide> // last argument in replacer is the entire input string
<ide> const input = args[args.length - 1];
<ide> if (value === null || value === undefined) {
<del> if (!allowEmpty)
<add> if (!allowEmpty) {
<ide> throw new Error(
<ide> `Path variable ${match} not implemented in this context: ${input}`
<ide> );
<add> }
<ide> return "";
<ide> } else {
<ide> return `${value}`;
<ide> class TemplatedPathPlugin {
<ide> const outputOptions = mainTemplate.outputOptions;
<ide> const chunkFilename =
<ide> outputOptions.chunkFilename || outputOptions.filename;
<del> if (REGEXP_CHUNKHASH_FOR_TEST.test(chunkFilename))
<add> if (REGEXP_CHUNKHASH_FOR_TEST.test(chunkFilename)) {
<ide> hash.update(JSON.stringify(chunk.getChunkMaps(true).hash));
<add> }
<ide> if (REGEXP_CONTENTHASH_FOR_TEST.test(chunkFilename)) {
<ide> hash.update(
<ide> JSON.stringify(
<ide> chunk.getChunkMaps(true).contentHash.javascript || {}
<ide> )
<ide> );
<ide> }
<del> if (REGEXP_NAME_FOR_TEST.test(chunkFilename))
<add> if (REGEXP_NAME_FOR_TEST.test(chunkFilename)) {
<ide> hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
<add> }
<ide> }
<ide> );
<ide> });
<ide><path>lib/UmdMainTemplatePlugin.js
<ide> class UmdMainTemplatePlugin {
<ide> .map(m => {
<ide> let expr;
<ide> let request = m.request;
<del> if (typeof request === "object") request = request[type];
<del> if (typeof request === "undefined")
<add> if (typeof request === "object") {
<add> request = request[type];
<add> }
<add> if (typeof request === "undefined") {
<ide> throw new Error(
<ide> "Missing external configuration for type:" + type
<ide> );
<add> }
<ide> if (Array.isArray(request)) {
<ide> expr = `require(${JSON.stringify(
<ide> request[0]
<ide> )})${accessorToObjectAccess(request.slice(1))}`;
<del> } else expr = `require(${JSON.stringify(request)})`;
<add> } else {
<add> expr = `require(${JSON.stringify(request)})`;
<add> }
<ide> if (m.optional) {
<ide> expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`;
<ide> }
<ide><path>lib/WarnCaseSensitiveModulesPlugin.js
<ide> class WarnCaseSensitiveModulesPlugin {
<ide> }
<ide> for (const pair of moduleWithoutCase) {
<ide> const array = pair[1];
<del> if (array.length > 1)
<add> if (array.length > 1) {
<ide> compilation.warnings.push(new CaseSensitiveModulesWarning(array));
<add> }
<ide> }
<ide> });
<ide> }
<ide><path>lib/Watching.js
<ide> class Watching {
<ide> ) => {
<ide> this.pausedWatcher = this.watcher;
<ide> this.watcher = null;
<del> if (err) return this.handler(err);
<del>
<add> if (err) {
<add> return this.handler(err);
<add> }
<ide> this.compiler.fileTimestamps = fileTimestamps;
<ide> this.compiler.contextTimestamps = contextTimestamps;
<ide> this._invalidate();
<ide><path>lib/WebpackOptionsApply.js
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> new ImportPlugin(options.module).apply(compiler);
<ide> new SystemPlugin(options.module).apply(compiler);
<ide>
<del> if (typeof options.mode !== "string")
<add> if (typeof options.mode !== "string") {
<ide> new WarnNoModeSetPlugin().apply(compiler);
<add> }
<ide>
<ide> new EnsureChunkConditionsPlugin().apply(compiler);
<del> if (options.optimization.removeAvailableModules)
<add> if (options.optimization.removeAvailableModules) {
<ide> new RemoveParentModulesPlugin().apply(compiler);
<del> if (options.optimization.removeEmptyChunks)
<add> }
<add> if (options.optimization.removeEmptyChunks) {
<ide> new RemoveEmptyChunksPlugin().apply(compiler);
<del> if (options.optimization.mergeDuplicateChunks)
<add> }
<add> if (options.optimization.mergeDuplicateChunks) {
<ide> new MergeDuplicateChunksPlugin().apply(compiler);
<del> if (options.optimization.flagIncludedChunks)
<add> }
<add> if (options.optimization.flagIncludedChunks) {
<ide> new FlagIncludedChunksPlugin().apply(compiler);
<del> if (options.optimization.occurrenceOrder)
<add> }
<add> if (options.optimization.occurrenceOrder) {
<ide> new OccurrenceOrderPlugin(true).apply(compiler);
<del> if (options.optimization.sideEffects)
<add> }
<add> if (options.optimization.sideEffects) {
<ide> new SideEffectsFlagPlugin().apply(compiler);
<del> if (options.optimization.providedExports)
<add> }
<add> if (options.optimization.providedExports) {
<ide> new FlagDependencyExportsPlugin().apply(compiler);
<del> if (options.optimization.usedExports)
<add> }
<add> if (options.optimization.usedExports) {
<ide> new FlagDependencyUsagePlugin().apply(compiler);
<del> if (options.optimization.concatenateModules)
<add> }
<add> if (options.optimization.concatenateModules) {
<ide> new ModuleConcatenationPlugin().apply(compiler);
<del> if (options.optimization.splitChunks)
<add> }
<add> if (options.optimization.splitChunks) {
<ide> new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler);
<del> if (options.optimization.runtimeChunk)
<add> }
<add> if (options.optimization.runtimeChunk) {
<ide> new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler);
<del> if (options.optimization.noEmitOnErrors)
<add> }
<add> if (options.optimization.noEmitOnErrors) {
<ide> new NoEmitOnErrorsPlugin().apply(compiler);
<del> if (options.optimization.namedModules)
<add> }
<add> if (options.optimization.namedModules) {
<ide> new NamedModulesPlugin().apply(compiler);
<del> if (options.optimization.namedChunks)
<add> }
<add> if (options.optimization.namedChunks) {
<ide> new NamedChunksPlugin().apply(compiler);
<add> }
<ide> if (options.optimization.nodeEnv) {
<ide> new DefinePlugin({
<ide> "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv)
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> }
<ide>
<ide> compiler.hooks.afterPlugins.call(compiler);
<del> if (!compiler.inputFileSystem)
<add> if (!compiler.inputFileSystem) {
<ide> throw new Error("No input filesystem provided");
<add> }
<ide> compiler.resolverFactory.hooks.resolveOptions
<ide> .for("normal")
<ide> .tap("WebpackOptionsApply", resolveOptions => {
<ide><path>lib/WebpackOptionsDefaulter.js
<ide> class WebpackOptionsDefaulter extends OptionsDefaulter {
<ide> }
<ide> });
<ide> this.set("output.devtoolNamespace", "make", options => {
<del> if (Array.isArray(options.output.library))
<add> if (Array.isArray(options.output.library)) {
<ide> return options.output.library.join(".");
<del> else if (typeof options.output.library === "object")
<add> } else if (typeof options.output.library === "object") {
<ide> return options.output.library.root || "";
<add> }
<ide> return options.output.library || "";
<ide> });
<ide> this.set("output.libraryTarget", "var");
<ide> class WebpackOptionsDefaulter extends OptionsDefaulter {
<ide> this.set("resolve.extensions", [".wasm", ".mjs", ".js", ".json"]);
<ide> this.set("resolve.mainFiles", ["index"]);
<ide> this.set("resolve.aliasFields", "make", options => {
<del> if (options.target === "web" || options.target === "webworker")
<add> if (options.target === "web" || options.target === "webworker") {
<ide> return ["browser"];
<del> else return [];
<add> } else {
<add> return [];
<add> }
<ide> });
<ide> this.set("resolve.mainFields", "make", options => {
<ide> if (
<ide><path>lib/WebpackOptionsValidationError.js
<ide> const getSchemaPartText = (schemaPart, additionalPath) => {
<ide> if (inner) schemaPart = inner;
<ide> }
<ide> }
<del> while (schemaPart.$ref) schemaPart = getSchemaPart(schemaPart.$ref);
<add> while (schemaPart.$ref) {
<add> schemaPart = getSchemaPart(schemaPart.$ref);
<add> }
<ide> let schemaText = WebpackOptionsValidationError.formatSchema(schemaPart);
<del> if (schemaPart.description) schemaText += `\n-> ${schemaPart.description}`;
<add> if (schemaPart.description) {
<add> schemaText += `\n-> ${schemaPart.description}`;
<add> }
<ide> return schemaText;
<ide> };
<ide>
<ide> const getSchemaPartDescription = schemaPart => {
<del> while (schemaPart.$ref) schemaPart = getSchemaPart(schemaPart.$ref);
<del> if (schemaPart.description) return `\n-> ${schemaPart.description}`;
<add> while (schemaPart.$ref) {
<add> schemaPart = getSchemaPart(schemaPart.$ref);
<add> }
<add> if (schemaPart.description) {
<add> return `\n-> ${schemaPart.description}`;
<add> }
<ide> return "";
<ide> };
<ide>
<ide> class WebpackOptionsValidationError extends WebpackError {
<ide> prevSchemas = prevSchemas || [];
<ide>
<ide> const formatInnerSchema = (innerSchema, addSelf) => {
<del> if (!addSelf)
<add> if (!addSelf) {
<ide> return WebpackOptionsValidationError.formatSchema(
<ide> innerSchema,
<ide> prevSchemas
<ide> );
<del> if (prevSchemas.includes(innerSchema)) return "(recursive)";
<add> }
<add> if (prevSchemas.includes(innerSchema)) {
<add> return "(recursive)";
<add> }
<ide> return WebpackOptionsValidationError.formatSchema(
<ide> innerSchema,
<ide> prevSchemas.concat(schema)
<ide> );
<ide> };
<ide>
<ide> if (schema.type === "string") {
<del> if (schema.minLength === 1) return "non-empty string";
<del> else if (schema.minLength > 1)
<add> if (schema.minLength === 1) {
<add> return "non-empty string";
<add> }
<add> if (schema.minLength > 1) {
<ide> return `string (min length ${schema.minLength})`;
<add> }
<ide> return "string";
<del> } else if (schema.type === "boolean") {
<add> }
<add> if (schema.type === "boolean") {
<ide> return "boolean";
<del> } else if (schema.type === "number") {
<add> }
<add> if (schema.type === "number") {
<ide> return "number";
<del> } else if (schema.type === "object") {
<add> }
<add> if (schema.type === "object") {
<ide> if (schema.properties) {
<ide> const required = schema.required || [];
<ide> return `object { ${Object.keys(schema.properties)
<ide> class WebpackOptionsValidationError extends WebpackError {
<ide> )} }`;
<ide> }
<ide> return "object";
<del> } else if (schema.type === "array") {
<add> }
<add> if (schema.type === "array") {
<ide> return `[${formatInnerSchema(schema.items)}]`;
<ide> }
<ide>
<ide> class WebpackOptionsValidationError extends WebpackError {
<ide> case "RegExp":
<ide> return "RegExp";
<ide> }
<del> if (schema.$ref) return formatInnerSchema(getSchemaPart(schema.$ref), true);
<del> if (schema.allOf) return schema.allOf.map(formatInnerSchema).join(" & ");
<del> if (schema.oneOf) return schema.oneOf.map(formatInnerSchema).join(" | ");
<del> if (schema.anyOf) return schema.anyOf.map(formatInnerSchema).join(" | ");
<del> if (schema.enum)
<add>
<add> if (schema.$ref) {
<add> return formatInnerSchema(getSchemaPart(schema.$ref), true);
<add> }
<add> if (schema.allOf) {
<add> return schema.allOf.map(formatInnerSchema).join(" & ");
<add> }
<add> if (schema.oneOf) {
<add> return schema.oneOf.map(formatInnerSchema).join(" | ");
<add> }
<add> if (schema.anyOf) {
<add> return schema.anyOf.map(formatInnerSchema).join(" | ");
<add> }
<add> if (schema.enum) {
<ide> return schema.enum.map(item => JSON.stringify(item)).join(" | ");
<add> }
<ide> return JSON.stringify(schema, null, 2);
<ide> }
<ide>
<ide> class WebpackOptionsValidationError extends WebpackError {
<ide> err.keyword === "minItems" ||
<ide> err.keyword === "minProperties"
<ide> ) {
<del> if (err.params.limit === 1)
<add> if (err.params.limit === 1) {
<ide> return `${dataPath} should not be empty.${getSchemaPartDescription(
<ide> err.parentSchema
<ide> )}`;
<del> else
<add> } else {
<ide> return `${dataPath} ${err.message}${getSchemaPartDescription(
<ide> err.parentSchema
<ide> )}`;
<add> }
<ide> } else if (err.keyword === "absolutePath") {
<ide> const baseMessage = `${dataPath}: ${
<ide> err.message
<ide><path>lib/dependencies/AMDDefineDependencyParserPlugin.js
<ide> class AMDDefineDependencyParserPlugin {
<ide> let fnParams = null;
<ide> let fnParamsOffset = 0;
<ide> if (fn) {
<del> if (isUnboundFunctionExpression(fn)) fnParams = fn.params;
<del> else if (isBoundFunctionExpression(fn)) {
<add> if (isUnboundFunctionExpression(fn)) {
<add> fnParams = fn.params;
<add> } else if (isBoundFunctionExpression(fn)) {
<ide> fnParams = fn.callee.object.params;
<ide> fnParamsOffset = fn.arguments.length - 1;
<del> if (fnParamsOffset < 0) fnParamsOffset = 0;
<add> if (fnParamsOffset < 0) {
<add> fnParamsOffset = 0;
<add> }
<ide> }
<ide> }
<ide> let fnRenames = parser.scope.renames.createChild();
<ide> class AMDDefineDependencyParserPlugin {
<ide> namedModule
<ide> );
<ide> if (!result) return;
<del> if (fnParams)
<add> if (fnParams) {
<ide> fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
<ide> if (identifiers[idx]) {
<ide> fnRenames.set(param.name, identifiers[idx]);
<ide> return false;
<ide> }
<ide> return true;
<ide> });
<add> }
<ide> } else {
<ide> const identifiers = ["require", "exports", "module"];
<del> if (fnParams)
<add> if (fnParams) {
<ide> fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
<ide> if (identifiers[idx]) {
<ide> fnRenames.set(param.name, identifiers[idx]);
<ide> return false;
<ide> }
<ide> return true;
<ide> });
<add> }
<ide> }
<ide> let inTry;
<ide> if (fn && isUnboundFunctionExpression(fn)) {
<ide> class AMDDefineDependencyParserPlugin {
<ide> () => {
<ide> parser.scope.renames = fnRenames;
<ide> parser.scope.inTry = inTry;
<del> if (fn.callee.object.body.type === "BlockStatement")
<add> if (fn.callee.object.body.type === "BlockStatement") {
<ide> parser.walkStatement(fn.callee.object.body);
<del> else parser.walkExpression(fn.callee.object.body);
<add> } else {
<add> parser.walkExpression(fn.callee.object.body);
<add> }
<ide> }
<ide> );
<del> if (fn.arguments) parser.walkExpressions(fn.arguments);
<add> if (fn.arguments) {
<add> parser.walkExpressions(fn.arguments);
<add> }
<ide> } else if (fn || obj) {
<ide> parser.walkExpression(fn || obj);
<ide> }
<ide><path>lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js
<ide> class AMDRequireDependenciesBlockParserPlugin {
<ide> return !["require", "module", "exports"].includes(i.name);
<ide> }),
<ide> () => {
<del> if (fnData.fn.body.type === "BlockStatement")
<add> if (fnData.fn.body.type === "BlockStatement") {
<ide> parser.walkStatement(fnData.fn.body);
<del> else parser.walkExpression(fnData.fn.body);
<add> } else {
<add> parser.walkExpression(fnData.fn.body);
<add> }
<ide> }
<ide> );
<ide> parser.walkExpressions(fnData.expressions);
<ide> class AMDRequireDependenciesBlockParserPlugin {
<ide> if (!result) {
<ide> dep = new UnsupportedDependency("unsupported", expr.range);
<ide> old.addDependency(dep);
<del> if (parser.state.module)
<add> if (parser.state.module) {
<ide> parser.state.module.errors.push(
<ide> new UnsupportedFeatureWarning(
<ide> parser.state.module,
<ide> "Cannot statically analyse 'require(…, …)' in line " +
<ide> expr.loc.start.line
<ide> )
<ide> );
<add> }
<ide> dep = null;
<ide> return true;
<ide> }
<ide><path>lib/dependencies/HarmonyDetectionParserPlugin.js
<ide> module.exports = class HarmonyDetectionParserPlugin {
<ide>
<ide> const skipInHarmony = () => {
<ide> const module = parser.state.module;
<del> if (module && module.buildMeta && module.buildMeta.exportsType)
<add> if (module && module.buildMeta && module.buildMeta.exportsType) {
<ide> return true;
<add> }
<ide> };
<ide>
<ide> const nullInHarmony = () => {
<ide> const module = parser.state.module;
<del> if (module && module.buildMeta && module.buildMeta.exportsType)
<add> if (module && module.buildMeta && module.buildMeta.exportsType) {
<ide> return null;
<add> }
<ide> };
<ide>
<ide> const nonHarmonyIdentifiers = ["define", "exports"];
<ide><path>lib/dependencies/HarmonyExportImportedSpecifierDependency.js
<ide> class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
<ide> otherImportedModule &&
<ide> Array.isArray(otherImportedModule.buildMeta.providedExports)
<ide> ) {
<del> for (const exportName of otherImportedModule.buildMeta.providedExports)
<add> for (const exportName of otherImportedModule.buildMeta
<add> .providedExports) {
<ide> result.add(exportName);
<add> }
<ide> }
<ide> }
<ide> return result;
<ide> HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
<ide>
<ide> // Filter out exports which are defined by other exports
<ide> // and filter out default export because it cannot be reexported with *
<del> if (activeExports.size > 0)
<add> if (activeExports.size > 0) {
<ide> content +=
<ide> "if(" +
<ide> JSON.stringify(Array.from(activeExports).concat("default")) +
<ide> ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
<del> else content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
<add> } else {
<add> content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
<add> }
<ide> const exportsName = dep.originModule.exportsArgument;
<ide> return (
<ide> content +
<ide><path>lib/dependencies/HarmonyImportDependencyParserPlugin.js
<ide> module.exports = class HarmonyImportDependencyParserPlugin {
<ide> (statement, source, id, name) => {
<ide> parser.scope.definitions.delete(name);
<ide> parser.scope.renames.set(name, "imported var");
<del> if (!parser.state.harmonySpecifier)
<add> if (!parser.state.harmonySpecifier) {
<ide> parser.state.harmonySpecifier = new Map();
<add> }
<ide> parser.state.harmonySpecifier.set(name, {
<ide> source,
<ide> id,
<ide> module.exports = class HarmonyImportDependencyParserPlugin {
<ide> return true;
<ide> });
<ide> // TODO webpack 5: refactor this, no custom hooks
<del> if (!parser.hooks.hotAcceptCallback)
<add> if (!parser.hooks.hotAcceptCallback) {
<ide> parser.hooks.hotAcceptCallback = new SyncBailHook([
<ide> "expression",
<ide> "requests"
<ide> ]);
<del> if (!parser.hooks.hotAcceptWithoutCallback)
<add> }
<add> if (!parser.hooks.hotAcceptWithoutCallback) {
<ide> parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
<ide> "expression",
<ide> "requests"
<ide> ]);
<add> }
<ide> parser.hooks.hotAcceptCallback.tap(
<ide> "HarmonyImportDependencyParserPlugin",
<ide> (expr, requests) => {
<ide><path>lib/dependencies/ImportParserPlugin.js
<ide> class ImportParserPlugin {
<ide>
<ide> apply(parser) {
<ide> parser.hooks.importCall.tap("ImportParserPlugin", expr => {
<del> if (expr.arguments.length !== 1)
<add> if (expr.arguments.length !== 1) {
<ide> throw new Error(
<ide> "Incorrect number of arguments provided to 'import(module: string) -> Promise'."
<ide> );
<add> }
<ide>
<ide> const param = parser.evaluateExpression(expr.arguments[0]);
<ide>
<ide><path>lib/dependencies/LoaderPlugin.js
<ide> class LoaderPlugin {
<ide> const factory = compilation.dependencyFactories.get(
<ide> dep.constructor
<ide> );
<del> if (factory === undefined)
<add> if (factory === undefined) {
<ide> return callback(
<ide> new Error(
<ide> `No module factory available for dependency type: ${
<ide> dep.constructor.name
<ide> }`
<ide> )
<ide> );
<add> }
<ide> compilation.semaphore.release();
<ide> compilation.addModuleDependencies(
<ide> module,
<ide> class LoaderPlugin {
<ide> true,
<ide> err => {
<ide> compilation.semaphore.acquire(() => {
<del> if (err) return callback(err);
<del>
<del> if (!dep.module)
<add> if (err) {
<add> return callback(err);
<add> }
<add> if (!dep.module) {
<ide> return callback(new Error("Cannot load the module"));
<del>
<del> if (dep.module.error) return callback(dep.module.error);
<del> if (!dep.module._source)
<add> }
<add> if (dep.module.error) {
<add> return callback(dep.module.error);
<add> }
<add> if (!dep.module._source) {
<ide> throw new Error(
<ide> "The module created for a LoaderDependency must have a property _source"
<ide> );
<add> }
<ide> let source, map;
<ide> const moduleSource = dep.module._source;
<ide> if (moduleSource.sourceAndMap) {
<ide><path>lib/dependencies/LocalModulesHelpers.js
<ide> const LocalModulesHelpers = exports;
<ide> const lookup = (parent, mod) => {
<ide> if (mod.charAt(0) !== ".") return mod;
<ide>
<del> var path = parent.split("/"),
<del> segs = mod.split("/");
<add> var path = parent.split("/");
<add> var segs = mod.split("/");
<ide> path.pop();
<ide>
<ide> for (let i = 0; i < segs.length; i++) {
<ide> const seg = segs[i];
<del> if (seg === "..") path.pop();
<del> else if (seg !== ".") path.push(seg);
<add> if (seg === "..") {
<add> path.pop();
<add> } else if (seg !== ".") {
<add> path.push(seg);
<add> }
<ide> }
<ide>
<ide> return path.join("/");
<ide> };
<ide>
<ide> LocalModulesHelpers.addLocalModule = (state, name) => {
<del> if (!state.localModules) state.localModules = [];
<add> if (!state.localModules) {
<add> state.localModules = [];
<add> }
<ide> const m = new LocalModule(state.module, name, state.localModules.length);
<ide> state.localModules.push(m);
<ide> return m;
<ide> LocalModulesHelpers.getLocalModule = (state, name, namedModule) => {
<ide> name = lookup(namedModule, name);
<ide> }
<ide> for (let i = 0; i < state.localModules.length; i++) {
<del> if (state.localModules[i].name === name) return state.localModules[i];
<add> if (state.localModules[i].name === name) {
<add> return state.localModules[i];
<add> }
<ide> }
<ide> return null;
<ide> };
<ide><path>lib/dependencies/RequireContextPlugin.js
<ide> const RequireContextDependencyParserPlugin = require("./RequireContextDependency
<ide>
<ide> class RequireContextPlugin {
<ide> constructor(modulesDirectories, extensions, mainFiles) {
<del> if (!Array.isArray(modulesDirectories))
<add> if (!Array.isArray(modulesDirectories)) {
<ide> throw new Error("modulesDirectories must be an array");
<del> if (!Array.isArray(extensions))
<add> }
<add> if (!Array.isArray(extensions)) {
<ide> throw new Error("extensions must be an array");
<add> }
<ide> this.modulesDirectories = modulesDirectories;
<ide> this.extensions = extensions;
<ide> this.mainFiles = mainFiles;
<ide><path>lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js
<ide> module.exports = class RequireEnsureDependenciesBlockParserPlugin {
<ide> return;
<ide> }
<ide> if (successExpression) {
<del> if (successExpression.fn.body.type === "BlockStatement")
<add> if (successExpression.fn.body.type === "BlockStatement") {
<ide> parser.walkStatement(successExpression.fn.body);
<del> else parser.walkExpression(successExpression.fn.body);
<add> } else {
<add> parser.walkExpression(successExpression.fn.body);
<add> }
<ide> }
<ide> old.addBlock(dep);
<ide> } finally {
<ide> module.exports = class RequireEnsureDependenciesBlockParserPlugin {
<ide> parser.walkExpression(successExpressionArg);
<ide> }
<ide> if (errorExpression) {
<del> if (errorExpression.fn.body.type === "BlockStatement")
<add> if (errorExpression.fn.body.type === "BlockStatement") {
<ide> parser.walkStatement(errorExpression.fn.body);
<del> else parser.walkExpression(errorExpression.fn.body);
<add> } else {
<add> parser.walkExpression(errorExpression.fn.body);
<add> }
<ide> } else if (errorExpressionArg) {
<ide> parser.walkExpression(errorExpressionArg);
<ide> }
<ide><path>lib/formatLocation.js
<ide> const formatPosition = pos => {
<ide> case "number":
<ide> return `${pos}`;
<ide> case "object":
<del> if (typeof pos.line === "number" && typeof pos.column === "number")
<add> if (typeof pos.line === "number" && typeof pos.column === "number") {
<ide> return `${pos.line}:${pos.column}`;
<del> else if (typeof pos.line === "number") return `${pos.line}:?`;
<del> else if (typeof pos.index === "number") return `+${pos.index}`;
<del> else return "";
<add> } else if (typeof pos.line === "number") {
<add> return `${pos.line}:?`;
<add> } else if (typeof pos.index === "number") {
<add> return `+${pos.index}`;
<add> } else {
<add> return "";
<add> }
<ide> default:
<ide> return "";
<ide> }
<ide> const formatLocation = loc => {
<ide> typeof loc.end.line === "number" &&
<ide> typeof loc.end.column === "number" &&
<ide> loc.start.line === loc.end.line
<del> )
<add> ) {
<ide> return `${formatPosition(loc.start)}-${loc.end.column}`;
<del> return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
<add> } else {
<add> return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
<add> }
<add> }
<add> if (loc.start) {
<add> return formatPosition(loc.start);
<ide> }
<del> if (loc.start) return formatPosition(loc.start);
<ide> return formatPosition(loc);
<ide> default:
<ide> return "";
<ide><path>lib/node/NodeMainTemplateAsync.runtime.js
<ide> module.exports = function() {
<ide> require("fs").readFile(filename, "utf-8", function(err, content) {
<ide> if (err) {
<ide> if ($require$.onError) return $require$.oe(err);
<del> else throw err;
<add> throw err;
<ide> }
<ide> var chunk = {};
<ide> require("vm").runInThisContext(
<ide><path>lib/node/NodeMainTemplatePlugin.js
<ide> module.exports = class NodeMainTemplatePlugin {
<ide> hashWithLength: length => {
<ide> const shortChunkHashMap = {};
<ide> for (const chunkId of Object.keys(chunkMaps.hash)) {
<del> if (typeof chunkMaps.hash[chunkId] === "string")
<add> if (typeof chunkMaps.hash[chunkId] === "string") {
<ide> shortChunkHashMap[chunkId] = chunkMaps.hash[
<ide> chunkId
<ide> ].substr(0, length);
<add> }
<ide> }
<ide> return `" + ${JSON.stringify(
<ide> shortChunkHashMap
<ide> module.exports = class NodeMainTemplatePlugin {
<ide> hashWithLength: length => {
<ide> const shortChunkHashMap = {};
<ide> for (const chunkId of Object.keys(chunkMaps.hash)) {
<del> if (typeof chunkMaps.hash[chunkId] === "string")
<add> if (typeof chunkMaps.hash[chunkId] === "string") {
<ide> shortChunkHashMap[chunkId] = chunkMaps.hash[
<ide> chunkId
<ide> ].substr(0, length);
<add> }
<ide> }
<ide> return `" + ${JSON.stringify(
<ide> shortChunkHashMap
<ide> module.exports = class NodeMainTemplatePlugin {
<ide> hashWithLength: length => {
<ide> const shortChunkHashMap = {};
<ide> for (const chunkId of Object.keys(chunkMaps.hash)) {
<del> if (typeof chunkMaps.hash[chunkId] === "string")
<add> if (typeof chunkMaps.hash[chunkId] === "string") {
<ide> shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(
<ide> 0,
<ide> length
<ide> );
<add> }
<ide> }
<ide> return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
<ide> },
<ide><path>lib/node/NodeSourcePlugin.js
<ide> module.exports = class NodeSourcePlugin {
<ide> }
<ide> apply(compiler) {
<ide> const options = this.options;
<del> if (options === false)
<add> if (options === false) {
<ide> // allow single kill switch to turn off this plugin
<ide> return;
<add> }
<ide>
<ide> const getPathToModule = (module, type) => {
<ide> if (type === true || (type === undefined && nodeLibsBrowser[module])) {
<del> if (!nodeLibsBrowser[module])
<add> if (!nodeLibsBrowser[module]) {
<ide> throw new Error(
<ide> `No browser version for node.js core module ${module} available`
<ide> );
<add> }
<ide> return nodeLibsBrowser[module];
<ide> } else if (type === "mock") {
<ide> return require.resolve(`node-libs-browser/mock/${module}`);
<ide> } else if (type === "empty") {
<ide> return require.resolve("node-libs-browser/mock/empty");
<del> } else return module;
<add> } else {
<add> return module;
<add> }
<ide> };
<ide>
<ide> const addExpression = (parser, name, module, type, suffix) => {
<ide> module.exports = class NodeSourcePlugin {
<ide> if (parserOptions.node === false) return;
<ide>
<ide> let localOptions = options;
<del> if (parserOptions.node)
<add> if (parserOptions.node) {
<ide> localOptions = Object.assign({}, localOptions, parserOptions.node);
<del>
<add> }
<ide> if (localOptions.global) {
<ide> parser.hooks.expression
<ide> .for("global")
<ide><path>lib/node/NodeWatchFileSystem.js
<ide> class NodeWatchFileSystem {
<ide> }
<ide>
<ide> watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
<del> if (!Array.isArray(files)) throw new Error("Invalid arguments: 'files'");
<del> if (!Array.isArray(dirs)) throw new Error("Invalid arguments: 'dirs'");
<del> if (!Array.isArray(missing))
<add> if (!Array.isArray(files)) {
<add> throw new Error("Invalid arguments: 'files'");
<add> }
<add> if (!Array.isArray(dirs)) {
<add> throw new Error("Invalid arguments: 'dirs'");
<add> }
<add> if (!Array.isArray(missing)) {
<ide> throw new Error("Invalid arguments: 'missing'");
<del> if (typeof callback !== "function")
<add> }
<add> if (typeof callback !== "function") {
<ide> throw new Error("Invalid arguments: 'callback'");
<del> if (typeof startTime !== "number" && startTime)
<add> }
<add> if (typeof startTime !== "number" && startTime) {
<ide> throw new Error("Invalid arguments: 'startTime'");
<del> if (typeof options !== "object")
<add> }
<add> if (typeof options !== "object") {
<ide> throw new Error("Invalid arguments: 'options'");
<del> if (typeof callbackUndelayed !== "function" && callbackUndelayed)
<add> }
<add> if (typeof callbackUndelayed !== "function" && callbackUndelayed) {
<ide> throw new Error("Invalid arguments: 'callbackUndelayed'");
<add> }
<ide> const oldWatcher = this.watcher;
<ide> this.watcher = new Watchpack(options);
<ide>
<del> if (callbackUndelayed) this.watcher.once("change", callbackUndelayed);
<add> if (callbackUndelayed) {
<add> this.watcher.once("change", callbackUndelayed);
<add> }
<ide>
<ide> this.watcher.once("aggregated", (changes, removals) => {
<ide> changes = changes.concat(removals);
<ide> class NodeWatchFileSystem {
<ide> }
<ide> },
<ide> getFileTimestamps: () => {
<del> if (this.watcher) return objectToMap(this.watcher.getTimes());
<del> else return new Map();
<add> if (this.watcher) {
<add> return objectToMap(this.watcher.getTimes());
<add> } else {
<add> return new Map();
<add> }
<ide> },
<ide> getContextTimestamps: () => {
<del> if (this.watcher) return objectToMap(this.watcher.getTimes());
<del> else return new Map();
<add> if (this.watcher) {
<add> return objectToMap(this.watcher.getTimes());
<add> } else {
<add> return new Map();
<add> }
<ide> }
<ide> };
<ide> }
<ide><path>lib/optimize/AggressiveSplittingPlugin.js
<ide> class AggressiveSplittingPlugin {
<ide> validateOptions(schema, options || {}, "Aggressive Splitting Plugin");
<ide>
<ide> this.options = options || {};
<del> if (typeof this.options.minSize !== "number")
<add> if (typeof this.options.minSize !== "number") {
<ide> this.options.minSize = 30 * 1024;
<del> if (typeof this.options.maxSize !== "number")
<add> }
<add> if (typeof this.options.maxSize !== "number") {
<ide> this.options.maxSize = 50 * 1024;
<del> if (typeof this.options.chunkOverhead !== "number")
<add> }
<add> if (typeof this.options.chunkOverhead !== "number") {
<ide> this.options.chunkOverhead = 0;
<del> if (typeof this.options.entryChunkMultiplicator !== "number")
<add> }
<add> if (typeof this.options.entryChunkMultiplicator !== "number") {
<ide> this.options.entryChunkMultiplicator = 1;
<add> }
<ide> }
<ide> apply(compiler) {
<ide> compiler.hooks.thisCompilation.tap(
<ide> class AggressiveSplittingPlugin {
<ide>
<ide> const applySplit = splitData => {
<ide> // Cannot split if id is already taken
<del> if (splitData.id !== undefined && usedIds.has(splitData.id))
<add> if (splitData.id !== undefined && usedIds.has(splitData.id)) {
<ide> return false;
<add> }
<ide>
<ide> // Get module objects from names
<ide> const selectedModules = splitData.modules.map(name =>
<ide> class AggressiveSplittingPlugin {
<ide> for (let k = 0; k < modules.length; k++) {
<ide> const module = modules[k];
<ide> const newSize = selectedModulesSize + module.size();
<del> if (newSize > maxSize && selectedModulesSize >= minSize)
<add> if (newSize > maxSize && selectedModulesSize >= minSize) {
<ide> break;
<add> }
<ide> selectedModulesSize = newSize;
<ide> selectedModules.push(module);
<ide> }
<ide><path>lib/optimize/ConcatenatedModule.js
<ide> const getFinalName = (
<ide> case "concatenated": {
<ide> const directExport = info.exportMap.get(exportName);
<ide> if (directExport) {
<del> if (exportName === true)
<add> if (exportName === true) {
<ide> ensureNsObjSource(
<ide> info,
<ide> moduleToInfoMap,
<ide> requestShortener,
<ide> strictHarmonyModule
<ide> );
<add> }
<ide> const name = info.internalNames.get(directExport);
<del> if (!name)
<add> if (!name) {
<ide> throw new Error(
<ide> `The export "${directExport}" in "${info.module.readableIdentifier(
<ide> requestShortener
<ide> )}" has no internal name`
<ide> );
<add> }
<ide> return name;
<ide> }
<ide> const reexport = info.reexportMap.get(exportName);
<ide> class ConcatenatedModule extends Module {
<ide> }
<ide> }
<ide> // populate warnings
<del> for (const warning of m.warnings) this.warnings.push(warning);
<add> for (const warning of m.warnings) {
<add> this.warnings.push(warning);
<add> }
<ide> // populate errors
<del> for (const error of m.errors) this.errors.push(error);
<add> for (const error of m.errors) {
<add> this.errors.push(error);
<add> }
<ide>
<ide> if (m.buildInfo.assets) {
<del> if (this.buildInfo.assets === undefined)
<add> if (this.buildInfo.assets === undefined) {
<ide> this.buildInfo.assets = Object.create(null);
<add> }
<ide> Object.assign(this.buildInfo.assets, m.buildInfo.assets);
<ide> }
<ide> }
<ide> class ConcatenatedModule extends Module {
<ide> const reexportMap = new Map();
<ide> for (const dep of info.module.dependencies) {
<ide> if (dep instanceof HarmonyExportSpecifierDependency) {
<del> if (!exportMap.has(dep.name)) exportMap.set(dep.name, dep.id);
<add> if (!exportMap.has(dep.name)) {
<add> exportMap.set(dep.name, dep.id);
<add> }
<ide> } else if (dep instanceof HarmonyExportExpressionDependency) {
<del> if (!exportMap.has("default"))
<add> if (!exportMap.has("default")) {
<ide> exportMap.set("default", "__WEBPACK_MODULE_DEFAULT_EXPORT__");
<add> }
<ide> } else if (
<ide> dep instanceof HarmonyExportImportedSpecifierDependency
<ide> ) {
<ide> class ConcatenatedModule extends Module {
<ide> }
<ide> } else if (importedModule) {
<ide> for (const name of importedModule.buildMeta.providedExports) {
<del> if (dep.activeExports.has(name) || name === "default")
<add> if (dep.activeExports.has(name) || name === "default") {
<ide> continue;
<add> }
<ide> if (!reexportMap.has(name)) {
<ide> reexportMap.set(name, {
<ide> module: importedModule,
<ide><path>lib/optimize/MergeDuplicateChunksPlugin.js
<ide> class MergeDuplicateChunksPlugin {
<ide> !notDuplicates.has(dup)
<ide> ) {
<ide> // delay allocating the new Set until here, reduce memory pressure
<del> if (possibleDuplicates === undefined)
<add> if (possibleDuplicates === undefined) {
<ide> possibleDuplicates = new Set();
<add> }
<ide> possibleDuplicates.add(dup);
<ide> }
<ide> }
<ide> class MergeDuplicateChunksPlugin {
<ide> // validate existing possible duplicates
<ide> for (const dup of possibleDuplicates) {
<ide> // remove possible duplicate when module is not contained
<del> if (!dup.containsModule(module))
<add> if (!dup.containsModule(module)) {
<ide> possibleDuplicates.delete(dup);
<add> }
<ide> }
<ide> // when all chunks has been removed we can break here
<ide> if (possibleDuplicates.size === 0) break;
<ide> class MergeDuplicateChunksPlugin {
<ide> for (const otherChunk of possibleDuplicates) {
<ide> if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue;
<ide> // merge them
<del> if (chunk.integrate(otherChunk, "duplicate"))
<add> if (chunk.integrate(otherChunk, "duplicate")) {
<ide> chunks.splice(chunks.indexOf(otherChunk), 1);
<add> }
<ide> }
<ide> }
<ide>
<ide><path>lib/optimize/ModuleConcatenationPlugin.js
<ide> class ModuleConcatenationPlugin {
<ide> )
<ide> .sort();
<ide> const explanations = Array.from(importingExplanations).sort();
<del> if (names.length > 0 && explanations.length === 0)
<add> if (names.length > 0 && explanations.length === 0) {
<ide> return `Module is referenced from these modules with unsupported syntax: ${names.join(
<ide> ", "
<ide> )}`;
<del> else if (names.length === 0 && explanations.length > 0)
<add> } else if (names.length === 0 && explanations.length > 0) {
<ide> return `Module is referenced by: ${explanations.join(
<ide> ", "
<ide> )}`;
<del> else if (names.length > 0 && explanations.length > 0)
<add> } else if (names.length > 0 && explanations.length > 0) {
<ide> return `Module is referenced from these modules with unsupported syntax: ${names.join(
<ide> ", "
<ide> )} and by: ${explanations.join(", ")}`;
<del> else return "Module is referenced in a unsupported way";
<add> } else {
<add> return "Module is referenced in a unsupported way";
<add> }
<ide> });
<ide> continue;
<ide> }
<ide> class ModuleConcatenationPlugin {
<ide> if (!currentConfiguration.isEmpty()) {
<ide> concatConfigurations.push(currentConfiguration);
<ide> for (const module of currentConfiguration.getModules()) {
<del> if (module !== currentConfiguration.rootModule)
<add> if (module !== currentConfiguration.rootModule) {
<ide> usedAsInner.add(module);
<add> }
<ide> }
<ide> }
<ide> }
<ide> class ModuleConcatenationPlugin {
<ide> newModule.optimizationBailout.push(requestShortener => {
<ide> const reason = getBailoutReason(warning[0], requestShortener);
<ide> const reasonWithPrefix = reason ? ` (<- ${reason})` : "";
<del> if (warning[0] === warning[1])
<add> if (warning[0] === warning[1]) {
<ide> return formatBailoutReason(
<ide> `Cannot concat with ${warning[0].readableIdentifier(
<ide> requestShortener
<ide> )}${reasonWithPrefix}`
<ide> );
<del> else
<add> } else {
<ide> return formatBailoutReason(
<ide> `Cannot concat with ${warning[0].readableIdentifier(
<ide> requestShortener
<ide> )} because of ${warning[1].readableIdentifier(
<ide> requestShortener
<ide> )}${reasonWithPrefix}`
<ide> );
<add> }
<ide> });
<ide> }
<ide> const chunks = concatConfiguration.rootModule.getChunks();
<ide> class ModuleConcatenationPlugin {
<ide> for (const chunk of chunks) {
<ide> chunk.addModule(newModule);
<ide> newModule.addChunk(chunk);
<del> if (chunk.entryModule === concatConfiguration.rootModule)
<add> if (chunk.entryModule === concatConfiguration.rootModule) {
<ide> chunk.entryModule = newModule;
<add> }
<ide> }
<ide> compilation.modules.push(newModule);
<ide> for (const reason of newModule.reasons) {
<ide> class ModuleConcatenationPlugin {
<ide> let reasons = dep.module.reasons;
<ide> for (let j = 0; j < reasons.length; j++) {
<ide> let reason = reasons[j];
<del> if (reason.dependency === dep) reason.module = newModule;
<add> if (reason.dependency === dep) {
<add> reason.module = newModule;
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>lib/optimize/OccurrenceOrderPlugin.js
<ide> class OccurrenceOrderPlugin {
<ide> }
<ide>
<ide> const countOccursInEntry = (sum, r) => {
<del> if (!r.module) return sum;
<add> if (!r.module) {
<add> return sum;
<add> }
<ide> return sum + initialChunkChunkMap.get(r.module);
<ide> };
<ide> const countOccurs = (sum, r) => {
<del> if (!r.module) return sum;
<add> if (!r.module) {
<add> return sum;
<add> }
<ide> let factor = 1;
<del> if (typeof r.dependency.getNumberOfIdOccurrences === "function")
<add> if (typeof r.dependency.getNumberOfIdOccurrences === "function") {
<ide> factor = r.dependency.getNumberOfIdOccurrences();
<del> if (factor === 0) return sum;
<add> }
<add> if (factor === 0) {
<add> return sum;
<add> }
<ide> return sum + factor * r.module.getNumberOfChunks();
<ide> };
<ide>
<ide><path>lib/optimize/RemoveParentModulesPlugin.js
<ide> class RemoveParentModulesPlugin {
<ide> for (const chunkGroup of compilation.entrypoints.values()) {
<ide> // initialize available modules for chunks without parents
<ide> availableModulesMap.set(chunkGroup, new Set());
<del> for (const child of chunkGroup.childrenIterable) queue.enqueue(child);
<add> for (const child of chunkGroup.childrenIterable) {
<add> queue.enqueue(child);
<add> }
<ide> }
<ide>
<ide> while (queue.length > 0) {
<ide> class RemoveParentModulesPlugin {
<ide> // if we have not own info yet: create new entry
<ide> availableModules = new Set(availableModulesInParent);
<ide> for (const chunk of parent.chunks) {
<del> for (const m of chunk.modulesIterable)
<add> for (const m of chunk.modulesIterable) {
<ide> availableModules.add(m);
<add> }
<ide> }
<ide> availableModulesMap.set(chunkGroup, availableModules);
<ide> changed = true;
<ide> class RemoveParentModulesPlugin {
<ide> }
<ide> if (changed) {
<ide> // if something changed: enqueue our children
<del> for (const child of chunkGroup.childrenIterable)
<add> for (const child of chunkGroup.childrenIterable) {
<ide> queue.enqueue(child);
<add> }
<ide> }
<ide> }
<ide>
<ide> class RemoveParentModulesPlugin {
<ide> const numberOfModules = chunk.getNumberOfModules();
<ide> const toRemove = new Set();
<ide> if (numberOfModules < availableModules.size) {
<del> for (const m of chunk.modulesIterable)
<del> if (availableModules.has(m)) toRemove.add(m);
<add> for (const m of chunk.modulesIterable) {
<add> if (availableModules.has(m)) {
<add> toRemove.add(m);
<add> }
<add> }
<ide> } else {
<del> for (const m of availableModules)
<del> if (chunk.containsModule(m)) toRemove.add(m);
<add> for (const m of availableModules) {
<add> if (chunk.containsModule(m)) {
<add> toRemove.add(m);
<add> }
<add> }
<ide> }
<ide> for (const module of toRemove) {
<ide> module.rewriteChunkInReasons(
<ide><path>lib/optimize/SideEffectsFlagPlugin.js
<ide> class SideEffectsFlagPlugin {
<ide> return module;
<ide> });
<ide> nmf.hooks.module.tap("SideEffectsFlagPlugin", (module, data) => {
<del> if (data.settings.sideEffects === false)
<add> if (data.settings.sideEffects === false) {
<ide> module.factoryMeta.sideEffectFree = true;
<del> else if (data.settings.sideEffects === true)
<add> } else if (data.settings.sideEffects === true) {
<ide> module.factoryMeta.sideEffectFree = false;
<add> }
<ide> });
<ide> });
<ide> compiler.hooks.compilation.tap("SideEffectsFlagPlugin", compilation => {
<ide><path>lib/optimize/SplitChunksPlugin.js
<ide> const getRequests = chunk => {
<ide>
<ide> const getModulesSize = modules => {
<ide> let sum = 0;
<del> for (const m of modules) sum += m.size();
<add> for (const m of modules) {
<add> sum += m.size();
<add> }
<ide> return sum;
<ide> };
<ide>
<ide> module.exports = class SplitChunksPlugin {
<ide> static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) {
<ide> if (typeof cacheGroups === "function") {
<ide> // TODO webpack 5 remove this
<del> if (cacheGroups.length !== 1)
<add> if (cacheGroups.length !== 1) {
<ide> return module => cacheGroups(module, module.getChunks());
<add> }
<ide> return cacheGroups;
<ide> }
<ide> if (cacheGroups && typeof cacheGroups === "object") {
<ide> module.exports = class SplitChunksPlugin {
<ide> if (result) {
<ide> if (results === undefined) results = [];
<ide> for (const r of Array.isArray(result) ? result : [result]) {
<del> const result = Object.assign(
<del> {
<del> key
<del> },
<del> r
<del> );
<add> const result = Object.assign({ key }, r);
<ide> if (result.name) result.getName = () => result.name;
<ide> if (result.chunks) {
<ide> result.chunksFilter = SplitChunksPlugin.normalizeChunksFilter(
<ide> module.exports = class SplitChunksPlugin {
<ide> static checkTest(test, module) {
<ide> if (test === undefined) return true;
<ide> if (typeof test === "function") {
<del> if (test.length !== 1) return test(module, module.getChunks());
<add> if (test.length !== 1) {
<add> return test(module, module.getChunks());
<add> }
<ide> return test(module);
<ide> }
<ide> if (typeof test === "boolean") return test;
<ide> if (typeof test === "string") {
<del> if (module.nameForCondition && module.nameForCondition().startsWith(test))
<add> if (
<add> module.nameForCondition &&
<add> module.nameForCondition().startsWith(test)
<add> ) {
<ide> return true;
<add> }
<ide> for (const chunk of module.chunksIterable) {
<del> if (chunk.name && chunk.name.startsWith(test)) return true;
<add> if (chunk.name && chunk.name.startsWith(test)) {
<add> return true;
<add> }
<ide> }
<ide> return false;
<ide> }
<ide> if (test instanceof RegExp) {
<del> if (module.nameForCondition && test.test(module.nameForCondition()))
<add> if (module.nameForCondition && test.test(module.nameForCondition())) {
<ide> return true;
<add> }
<ide> for (const chunk of module.chunksIterable) {
<del> if (chunk.name && test.test(chunk.name)) return true;
<add> if (chunk.name && test.test(chunk.name)) {
<add> return true;
<add> }
<ide> }
<ide> return false;
<ide> }
<ide> module.exports = class SplitChunksPlugin {
<ide> for (const module of compilation.modules) {
<ide> // Get cache group
<ide> let cacheGroups = this.options.getCacheGroups(module);
<del> if (!Array.isArray(cacheGroups) || cacheGroups.length === 0)
<add> if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) {
<ide> continue;
<add> }
<ide>
<ide> // Prepare some values
<ide> const chunksKey = getKey(module.chunksIterable);
<ide> module.exports = class SplitChunksPlugin {
<ide> if (pair[1] === item.modules.size) {
<ide> const chunk = pair[0];
<ide> if (chunk.hasEntryModule()) continue;
<del> if (!newChunk || !newChunk.name) newChunk = chunk;
<del> else if (
<add> if (!newChunk || !newChunk.name) {
<add> newChunk = chunk;
<add> } else if (
<ide> chunk.name &&
<ide> chunk.name.length < newChunk.name.length
<del> )
<add> ) {
<ide> newChunk = chunk;
<del> else if (
<add> } else if (
<ide> chunk.name &&
<ide> chunk.name.length === newChunk.name.length &&
<ide> chunk.name < newChunk.name
<del> )
<add> ) {
<ide> newChunk = chunk;
<add> }
<ide> chunkName = undefined;
<ide> isReused = true;
<ide> }
<ide> module.exports = class SplitChunksPlugin {
<ide> }
<ide> if (info.modules.size !== oldSize) {
<ide> info.size = getModulesSize(info.modules);
<del> if (info.size < info.cacheGroup.minSize)
<add> if (info.size < info.cacheGroup.minSize) {
<ide> chunksInfoMap.delete(key);
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>lib/util/SortableSet.js
<ide> class SortableSet extends Set {
<ide> }
<ide>
<ide> _invalidateCache() {
<del> if (this._cache !== undefined) this._cache.clear();
<add> if (this._cache !== undefined) {
<add> this._cache.clear();
<add> }
<ide> }
<ide>
<ide> _invalidateOrderedCache() {
<del> if (this._cacheOrderIndependent !== undefined)
<add> if (this._cacheOrderIndependent !== undefined) {
<ide> this._cacheOrderIndependent.clear();
<add> }
<ide> }
<ide> }
<ide>
<ide><path>lib/util/StackedSetMap.js
<ide> class StackedSetMap {
<ide> }
<ide>
<ide> delete(item) {
<del> if (this.stack.length > 1) this.map.set(item, TOMBSTONE);
<del> else this.map.delete(item);
<add> if (this.stack.length > 1) {
<add> this.map.set(item, TOMBSTONE);
<add> } else {
<add> this.map.delete(item);
<add> }
<ide> }
<ide>
<ide> has(item) {
<ide> class StackedSetMap {
<ide>
<ide> get(item) {
<ide> const topValue = this.map.get(item);
<del> if (topValue !== undefined)
<add> if (topValue !== undefined) {
<ide> return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER
<ide> ? undefined
<ide> : topValue;
<add> }
<ide> if (this.stack.length > 1) {
<ide> for (var i = this.stack.length - 2; i >= 0; i--) {
<ide> const value = this.stack[i].get(item);
<ide> class StackedSetMap {
<ide> this.map = new Map();
<ide> for (const data of this.stack) {
<ide> for (const pair of data) {
<del> if (pair[1] === TOMBSTONE) this.map.delete(pair[0]);
<del> else this.map.set(pair[0], pair[1]);
<add> if (pair[1] === TOMBSTONE) {
<add> this.map.delete(pair[0]);
<add> } else {
<add> this.map.set(pair[0], pair[1]);
<add> }
<ide> }
<ide> }
<ide> this.stack = [this.map];
<ide><path>lib/wasm/WasmMainTemplatePlugin.js
<ide> class WasmMainTemplatePlugin {
<ide> hashWithLength(length) {
<ide> const shortChunkHashMap = Object.create(null);
<ide> for (const wasmModuleId of Object.keys(chunkModuleMaps.hash)) {
<del> if (typeof chunkModuleMaps.hash[wasmModuleId] === "string")
<add> if (typeof chunkModuleMaps.hash[wasmModuleId] === "string") {
<ide> shortChunkHashMap[wasmModuleId] = chunkModuleMaps.hash[
<ide> wasmModuleId
<ide> ].substr(0, length);
<add> }
<ide> }
<ide> return `" + ${JSON.stringify(
<ide> shortChunkHashMap
<ide> class WasmMainTemplatePlugin {
<ide> mainTemplate.hooks.requireExtensions.tap(
<ide> "WasmMainTemplatePlugin",
<ide> (source, chunk) => {
<del> if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly")))
<add> if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) {
<ide> return source;
<add> }
<ide> return Template.asString([
<ide> source,
<ide> "",
<ide><path>lib/web/JsonpMainTemplate.runtime.js
<ide> module.exports = function() {
<ide> function hotDownloadManifest(requestTimeout) {
<ide> requestTimeout = requestTimeout || 10000;
<ide> return new Promise(function(resolve, reject) {
<del> if (typeof XMLHttpRequest === "undefined")
<add> if (typeof XMLHttpRequest === "undefined") {
<ide> return reject(new Error("No browser support"));
<add> }
<ide> try {
<ide> var request = new XMLHttpRequest();
<ide> var requestPath = $require$.p + $hotMainFilename$;
<ide><path>lib/web/JsonpMainTemplatePlugin.js
<ide> class JsonpMainTemplatePlugin {
<ide> hashWithLength(length) {
<ide> const shortChunkHashMap = Object.create(null);
<ide> for (const chunkId of Object.keys(chunkMaps.hash)) {
<del> if (typeof chunkMaps.hash[chunkId] === "string")
<add> if (typeof chunkMaps.hash[chunkId] === "string") {
<ide> shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(
<ide> 0,
<ide> length
<ide> );
<add> }
<ide> }
<ide> return `" + ${JSON.stringify(
<ide> shortChunkHashMap
<ide><path>lib/webpack.js
<ide> const webpack = (options, callback) => {
<ide> throw new Error("Invalid argument: options");
<ide> }
<ide> if (callback) {
<del> if (typeof callback !== "function")
<add> if (typeof callback !== "function") {
<ide> throw new Error("Invalid argument: callback");
<add> }
<ide> if (
<ide> options.watch === true ||
<ide> (Array.isArray(options) && options.some(o => o.watch))
<ide><path>lib/webworker/WebWorkerMainTemplate.runtime.js
<ide> module.exports = function() {
<ide> function hotDownloadManifest(requestTimeout) {
<ide> requestTimeout = requestTimeout || 10000;
<ide> return new Promise(function(resolve, reject) {
<del> if (typeof XMLHttpRequest === "undefined")
<add> if (typeof XMLHttpRequest === "undefined") {
<ide> return reject(new Error("No browser support"));
<add> }
<ide> try {
<ide> var request = new XMLHttpRequest();
<ide> var requestPath = $require$.p + $hotMainFilename$; | 84 |
Javascript | Javascript | add tls benchmark for legacy securepair | c346cb6929b0ec1140e88234ab0185b67519186c | <ide><path>benchmark/tls/secure-pair.js
<add>'use strict';
<add>const common = require('../common.js');
<add>const bench = common.createBenchmark(main, {
<add> dur: [5],
<add> securing: ['SecurePair', 'TLSSocket'],
<add> size: [2, 1024, 1024 * 1024]
<add>});
<add>
<add>const fs = require('fs');
<add>const tls = require('tls');
<add>const net = require('net');
<add>const path = require('path');
<add>
<add>const cert_dir = path.resolve(__dirname, '../../test/fixtures');
<add>const REDIRECT_PORT = 28347;
<add>
<add>function main({ dur, size, securing }) {
<add> const chunk = Buffer.alloc(size, 'b');
<add>
<add> const options = {
<add> key: fs.readFileSync(`${cert_dir}/test_key.pem`),
<add> cert: fs.readFileSync(`${cert_dir}/test_cert.pem`),
<add> ca: [ fs.readFileSync(`${cert_dir}/test_ca.pem`) ],
<add> ciphers: 'AES256-GCM-SHA384',
<add> isServer: true,
<add> requestCert: true,
<add> rejectUnauthorized: true,
<add> };
<add>
<add> const server = net.createServer(onRedirectConnection);
<add> server.listen(REDIRECT_PORT, () => {
<add> const proxy = net.createServer(onProxyConnection);
<add> proxy.listen(common.PORT, () => {
<add> const clientOptions = {
<add> port: common.PORT,
<add> ca: options.ca,
<add> key: options.key,
<add> cert: options.cert,
<add> isServer: false,
<add> rejectUnauthorized: false,
<add> };
<add> const conn = tls.connect(clientOptions, () => {
<add> setTimeout(() => {
<add> const mbits = (received * 8) / (1024 * 1024);
<add> bench.end(mbits);
<add> if (conn)
<add> conn.destroy();
<add> server.close();
<add> proxy.close();
<add> }, dur * 1000);
<add> bench.start();
<add> conn.on('drain', write);
<add> write();
<add> });
<add> conn.on('error', (e) => {
<add> throw new Error(`Client error: ${e}`);
<add> });
<add>
<add> function write() {
<add> while (false !== conn.write(chunk));
<add> }
<add> });
<add> });
<add>
<add> function onProxyConnection(conn) {
<add> const client = net.connect(REDIRECT_PORT, () => {
<add> switch (securing) {
<add> case 'SecurePair':
<add> securePair(conn, client);
<add> break;
<add> case 'TLSSocket':
<add> secureTLSSocket(conn, client);
<add> break;
<add> default:
<add> throw new Error('Invalid securing method');
<add> }
<add> });
<add> }
<add>
<add> function securePair(conn, client) {
<add> const serverCtx = tls.createSecureContext(options);
<add> const serverPair = tls.createSecurePair(serverCtx, true, true, false);
<add> conn.pipe(serverPair.encrypted);
<add> serverPair.encrypted.pipe(conn);
<add> serverPair.on('error', (error) => {
<add> throw new Error(`Pair error: ${error}`);
<add> });
<add> serverPair.cleartext.pipe(client);
<add> }
<add>
<add> function secureTLSSocket(conn, client) {
<add> const serverSocket = new tls.TLSSocket(conn, options);
<add> serverSocket.on('error', (e) => {
<add> throw new Error(`Socket error: ${e}`);
<add> });
<add> serverSocket.pipe(client);
<add> }
<add>
<add> let received = 0;
<add> function onRedirectConnection(conn) {
<add> conn.on('data', (chunk) => {
<add> received += chunk.length;
<add> });
<add> }
<add>}
<ide><path>test/sequential/test-benchmark-tls.js
<ide> runBenchmark('tls',
<ide> 'dur=0.1',
<ide> 'n=1',
<ide> 'size=2',
<add> 'securing=SecurePair',
<ide> 'type=asc'
<ide> ],
<ide> { | 2 |
Python | Python | fix bash command in performance test dag | a6434a528764910d1ed09b1e9e0eb56b9c70342e | <ide><path>scripts/perf/dags/elastic_dag.py
<ide> class DagShape(Enum):
<ide>
<ide> elastic_dag_tasks = [
<ide> BashOperator(
<del> task_id="__".join(["tasks", f"{i}_of_{TASKS_COUNT}"]), bash_command='echo test"', dag=dag
<add> task_id="__".join(["tasks", f"{i}_of_{TASKS_COUNT}"]), bash_command='echo test', dag=dag
<ide> )
<ide> for i in range(1, TASKS_COUNT + 1)
<ide> ] | 1 |
PHP | PHP | remove extra period from docblock | 669b118bba3e8feb4d9b97a50a88602bde471464 | <ide><path>src/Illuminate/Auth/TokenGuard.php
<ide> class TokenGuard implements Guard
<ide> *
<ide> * @param \Illuminate\Contracts\Auth\UserProvider $provider
<ide> * @param \Illuminate\Http\Request $request
<del> * @param. string $inputKey
<add> * @param string $inputKey
<ide> * @param string $storageKey
<ide> * @return void
<ide> */ | 1 |
Python | Python | add dag_run table | 58519878bba9cf39f9abaf9a2cb016aa1b8f683e | <ide><path>airflow/migrations/versions/19054f4ff36_add_dagrun.py
<add>"""add DagRun
<add>
<add>Revision ID: 19054f4ff36
<add>Revises: 338e90f54d61
<add>Create Date: 2015-10-12 09:55:52.475712
<add>
<add>"""
<add>
<add># revision identifiers, used by Alembic.
<add>revision = '19054f4ff36'
<add>down_revision = '338e90f54d61'
<add>branch_labels = None
<add>depends_on = None
<add>
<add>from alembic import op
<add>import sqlalchemy as sa
<add>
<add>
<add>def upgrade():
<add> op.create_table(
<add> 'dag_run',
<add> sa.Column('dag_id', sa.String(length=250), nullable=False),
<add> sa.Column('execution_date', sa.DateTime(), nullable=False),
<add> sa.Column('run_id', sa.String(length=250), nullable=False),
<add> sa.PrimaryKeyConstraint('dag_id', 'execution_date')
<add> )
<add>
<add>
<add>def downgrade():
<add> op.drop_table('dag_run')
<ide><path>airflow/models.py
<ide> def delete(cls, xcoms, session=None):
<ide> session.commit()
<ide>
<ide>
<add>class DagRun(Base):
<add> """
<add> DagRun describes an instance of a Dag. It can be created
<add> by a scheduled of a Dag or by an external trigger
<add> """
<add> __tablename__ = "dag_run"
<add>
<add> dag_id = Column(String(ID_LEN), primary_key=True)
<add> execution_date = Column(DateTime, primary_key=True)
<add> run_id = Column(String(ID_LEN))
<add> timestamp = Column(DateTime)
<add> description = Column(Text)
<add>
<add> def __repr__(self):
<add> return str((
<add> self.dag_id, self.run_id, self.execution_date.isoformat()))
<add>
<add>
<ide> class Pool(Base):
<ide> __tablename__ = "slot_pool"
<ide> | 2 |
Python | Python | suppress import errors for providers from sources | b5a786b38148295c492da8ab731d5e2f6f86ccf7 | <ide><path>airflow/api_connexion/endpoints/provider_endpoint.py
<ide> def _remove_rst_syntax(value: str) -> str:
<ide>
<ide> def _provider_mapper(provider: ProviderInfo) -> Provider:
<ide> return Provider(
<del> package_name=provider[1]["package-name"],
<del> description=_remove_rst_syntax(provider[1]["description"]),
<del> version=provider[0],
<add> package_name=provider.data["package-name"],
<add> description=_remove_rst_syntax(provider.data["description"]),
<add> version=provider.version,
<ide> )
<ide>
<ide>
<ide><path>airflow/cli/commands/info_command.py
<ide> def _paths_info(self):
<ide>
<ide> @property
<ide> def _providers_info(self):
<del> return [(p.provider_info['package-name'], p.version) for p in ProvidersManager().providers.values()]
<add> return [(p.data['package-name'], p.version) for p in ProvidersManager().providers.values()]
<ide>
<ide> def show(self, output: str, console: Optional[AirflowConsole] = None) -> None:
<ide> """Shows information about Airflow instance"""
<ide><path>airflow/cli/commands/provider_command.py
<ide> def provider_get(args):
<ide> providers = ProvidersManager().providers
<ide> if args.provider_name in providers:
<ide> provider_version = providers[args.provider_name].version
<del> provider_info = providers[args.provider_name].provider_info
<add> provider_info = providers[args.provider_name].data
<ide> if args.full:
<ide> provider_info["description"] = _remove_rst_syntax(provider_info["description"])
<ide> AirflowConsole().print_as(
<ide> def providers_list(args):
<ide> data=list(ProvidersManager().providers.values()),
<ide> output=args.output,
<ide> mapper=lambda x: {
<del> "package_name": x[1]["package-name"],
<del> "description": _remove_rst_syntax(x[1]["description"]),
<del> "version": x[0],
<add> "package_name": x.data["package-name"],
<add> "description": _remove_rst_syntax(x.data["description"]),
<add> "version": x.version,
<ide> },
<ide> )
<ide>
<ide><path>airflow/providers_manager.py
<ide> import sys
<ide> import warnings
<ide> from collections import OrderedDict
<add>from dataclasses import dataclass
<ide> from functools import wraps
<ide> from time import perf_counter
<ide> from typing import (
<ide>
<ide> from airflow.exceptions import AirflowOptionalProviderFeatureException
<ide> from airflow.hooks.base import BaseHook
<add>from airflow.typing_compat import Literal
<ide> from airflow.utils import yaml
<ide> from airflow.utils.entry_points import entry_points_with_dist
<ide> from airflow.utils.log.logging_mixin import LoggingMixin
<ide> def _check_builtin_provider_prefix(provider_package: str, class_name: str) -> bo
<ide> return True
<ide>
<ide>
<del>def _sanity_check(provider_package: str, class_name: str) -> Optional[Type[BaseHook]]:
<add>@dataclass
<add>class ProviderInfo:
<add> """
<add> Provider information
<add>
<add> :param version: version string
<add> :param data: dictionary with information about the provider
<add> :param source_or_package: whether the provider is source files or PyPI package. When installed from
<add> sources we suppress provider import errors.
<add> """
<add>
<add> version: str
<add> data: Dict
<add> package_or_source: Union[Literal['source'], Literal['package']]
<add>
<add> def __post_init__(self):
<add> if self.package_or_source not in ('source', 'package'):
<add> raise ValueError(
<add> f"Received {self.package_or_source!r} for `package_or_source`. "
<add> "Must be either 'package' or 'source'."
<add> )
<add> self.is_source = self.package_or_source == 'source'
<add>
<add>
<add>class HookClassProvider(NamedTuple):
<add> """Hook class and Provider it comes from"""
<add>
<add> hook_class_name: str
<add> package_name: str
<add>
<add>
<add>class HookInfo(NamedTuple):
<add> """Hook information"""
<add>
<add> hook_class_name: str
<add> connection_id_attribute_name: str
<add> package_name: str
<add> hook_name: str
<add> connection_type: str
<add> connection_testable: bool
<add>
<add>
<add>class ConnectionFormWidgetInfo(NamedTuple):
<add> """Connection Form Widget information"""
<add>
<add> hook_class_name: str
<add> package_name: str
<add> field: Any
<add>
<add>
<add>T = TypeVar("T", bound=Callable)
<add>
<add>logger = logging.getLogger(__name__)
<add>
<add>
<add>def _sanity_check(
<add> provider_package: str, class_name: str, provider_info: ProviderInfo
<add>) -> Optional[Type[BaseHook]]:
<ide> """
<ide> Performs coherence check on provider classes.
<ide> For apache-airflow providers - it checks if it starts with appropriate package. For all providers
<ide> def _sanity_check(provider_package: str, class_name: str) -> Optional[Type[BaseH
<ide> except ImportError as e:
<ide> # When there is an ImportError we turn it into debug warnings as this is
<ide> # an expected case when only some providers are installed
<del> log.warning(
<del> "Exception when importing '%s' from '%s' package",
<del> class_name,
<del> provider_package,
<del> exc_info=e,
<del> )
<add> if provider_info.is_source:
<add> log.debug(
<add> "Exception when importing '%s' from '%s' package",
<add> class_name,
<add> provider_package,
<add> )
<add> else:
<add> log.warning(
<add> "Exception when importing '%s' from '%s' package",
<add> class_name,
<add> provider_package,
<add> exc_info=e,
<add> )
<ide> return None
<ide> except Exception as e:
<ide> log.warning(
<ide> def _sanity_check(provider_package: str, class_name: str) -> Optional[Type[BaseH
<ide> return imported_class
<ide>
<ide>
<del>class ProviderInfo(NamedTuple):
<del> """Provider information"""
<del>
<del> version: str
<del> provider_info: Dict
<del>
<del>
<del>class HookClassProvider(NamedTuple):
<del> """Hook class and Provider it comes from"""
<del>
<del> hook_class_name: str
<del> package_name: str
<del>
<del>
<del>class HookInfo(NamedTuple):
<del> """Hook information"""
<del>
<del> hook_class_name: str
<del> connection_id_attribute_name: str
<del> package_name: str
<del> hook_name: str
<del> connection_type: str
<del> connection_testable: bool
<del>
<del>
<del>class ConnectionFormWidgetInfo(NamedTuple):
<del> """Connection Form Widget information"""
<del>
<del> hook_class_name: str
<del> package_name: str
<del> field: Any
<del>
<del>
<del>T = TypeVar("T", bound=Callable)
<del>
<del>logger = logging.getLogger(__name__)
<del>
<del>
<ide> # We want to have better control over initialization of parameters and be able to debug and test it
<ide> # So we add our own decorator
<ide> def provider_info_cache(cache_name: str) -> Callable[[T], T]:
<ide> def _discover_all_providers_from_packages(self) -> None:
<ide> f"{provider_info_package_name} do not match. Please make sure they are aligned"
<ide> )
<ide> if package_name not in self._provider_dict:
<del> self._provider_dict[package_name] = ProviderInfo(version, provider_info)
<add> self._provider_dict[package_name] = ProviderInfo(version, provider_info, 'package')
<ide> else:
<ide> log.warning(
<ide> "The provider for package '%s' could not be registered from because providers for that "
<ide> def _add_provider_info_from_local_source_file(self, path, package_name) -> None:
<ide>
<ide> version = provider_info['versions'][0]
<ide> if package_name not in self._provider_dict:
<del> self._provider_dict[package_name] = ProviderInfo(version, provider_info)
<add> self._provider_dict[package_name] = ProviderInfo(version, provider_info, 'source')
<ide> else:
<ide> log.warning(
<ide> "The providers for package '%s' could not be registered because providers for that "
<ide> def _discover_hooks_from_connection_types(
<ide> :return:
<ide> """
<ide> provider_uses_connection_types = False
<del> connection_types = provider.provider_info.get("connection-types")
<add> connection_types = provider.data.get("connection-types")
<ide> if connection_types:
<ide> for connection_type_dict in connection_types:
<ide> connection_type = connection_type_dict['connection-type']
<ide> def _discover_hooks_from_connection_types(
<ide> )
<ide> # Defer importing hook to access time by setting import hook method as dict value
<ide> self._hooks_lazy_dict[connection_type] = functools.partial(
<del> self._import_hook, connection_type
<add> self._import_hook,
<add> connection_type=connection_type,
<add> provider_info=provider,
<ide> )
<ide> provider_uses_connection_types = True
<ide> return provider_uses_connection_types
<ide> def _discover_hooks_from_hook_class_names(
<ide> form of passing connection types
<ide> :return:
<ide> """
<del> hook_class_names = provider.provider_info.get("hook-class-names")
<add> hook_class_names = provider.data.get("hook-class-names")
<ide> if hook_class_names:
<ide> for hook_class_name in hook_class_names:
<ide> if hook_class_name in hook_class_names_registered:
<ide> # Silently ignore the hook class - it's already marked for lazy-import by
<ide> # connection-types discovery
<ide> continue
<ide> hook_info = self._import_hook(
<del> connection_type=None, hook_class_name=hook_class_name, package_name=package_name
<add> connection_type=None,
<add> provider_info=provider,
<add> hook_class_name=hook_class_name,
<add> package_name=package_name,
<ide> )
<ide> if not hook_info:
<ide> # Problem why importing class - we ignore it. Log is written at import time
<ide> def _import_info_from_all_hooks(self):
<ide>
<ide> def _discover_taskflow_decorators(self) -> None:
<ide> for name, info in self._provider_dict.items():
<del> for taskflow_decorator in info.provider_info.get("task-decorators", []):
<add> for taskflow_decorator in info.data.get("task-decorators", []):
<ide> self._add_taskflow_decorator(
<ide> taskflow_decorator["name"], taskflow_decorator["class-name"], name
<ide> )
<ide> def _get_attr(obj: Any, attr_name: str):
<ide> def _import_hook(
<ide> self,
<ide> connection_type: Optional[str],
<add> provider_info: ProviderInfo,
<ide> hook_class_name: Optional[str] = None,
<ide> package_name: Optional[str] = None,
<ide> ) -> Optional[HookInfo]:
<ide> def _import_hook(
<ide> f"Provider package name is not set when hook_class_name ({hook_class_name}) is used"
<ide> )
<ide> allowed_field_classes = [IntegerField, PasswordField, StringField, BooleanField]
<del> hook_class = _sanity_check(package_name, hook_class_name)
<add> hook_class = _sanity_check(package_name, hook_class_name, provider_info)
<ide> if hook_class is None:
<ide> return None
<ide> try:
<ide> def _add_customized_fields(self, package_name: str, hook_class: type, customized
<ide>
<ide> def _discover_extra_links(self) -> None:
<ide> """Retrieves all extra links defined in the providers"""
<del> for provider_package, (_, provider) in self._provider_dict.items():
<del> if provider.get("extra-links"):
<del> for extra_link_class_name in provider["extra-links"]:
<del> if _sanity_check(provider_package, extra_link_class_name):
<add> for provider_package, provider in self._provider_dict.items():
<add> if provider.data.get("extra-links"):
<add> for extra_link_class_name in provider.data["extra-links"]:
<add> if _sanity_check(provider_package, extra_link_class_name, provider):
<ide> self._extra_link_class_name_set.add(extra_link_class_name)
<ide>
<ide> def _discover_logging(self) -> None:
<ide> """Retrieves all logging defined in the providers"""
<del> for provider_package, (_, provider) in self._provider_dict.items():
<del> if provider.get("logging"):
<del> for logging_class_name in provider["logging"]:
<del> if _sanity_check(provider_package, logging_class_name):
<add> for provider_package, provider in self._provider_dict.items():
<add> if provider.data.get("logging"):
<add> for logging_class_name in provider.data["logging"]:
<add> if _sanity_check(provider_package, logging_class_name, provider):
<ide> self._logging_class_name_set.add(logging_class_name)
<ide>
<ide> def _discover_secrets_backends(self) -> None:
<ide> """Retrieves all secrets backends defined in the providers"""
<del> for provider_package, (_, provider) in self._provider_dict.items():
<del> if provider.get("secrets-backends"):
<del> for secrets_backends_class_name in provider["secrets-backends"]:
<del> if _sanity_check(provider_package, secrets_backends_class_name):
<add> for provider_package, provider in self._provider_dict.items():
<add> if provider.data.get("secrets-backends"):
<add> for secrets_backends_class_name in provider.data["secrets-backends"]:
<add> if _sanity_check(provider_package, secrets_backends_class_name, provider):
<ide> self._secrets_backend_class_name_set.add(secrets_backends_class_name)
<ide>
<ide> def _discover_auth_backends(self) -> None:
<ide> """Retrieves all API auth backends defined in the providers"""
<del> for provider_package, (_, provider) in self._provider_dict.items():
<del> if provider.get("auth-backends"):
<del> for auth_backend_module_name in provider["auth-backends"]:
<del> if _sanity_check(provider_package, auth_backend_module_name + ".init_app"):
<add> for provider_package, provider in self._provider_dict.items():
<add> if provider.data.get("auth-backends"):
<add> for auth_backend_module_name in provider.data["auth-backends"]:
<add> if _sanity_check(provider_package, auth_backend_module_name + ".init_app", provider):
<ide> self._api_auth_backend_module_names.add(auth_backend_module_name)
<ide>
<ide> @property
<ide><path>tests/api_connexion/endpoints/test_provider_endpoint.py
<ide>
<ide> import pytest
<ide>
<add>from airflow.providers_manager import ProviderInfo
<ide> from airflow.security import permissions
<ide> from tests.test_utils.api_connexion_utils import create_user, delete_user
<ide>
<ide> MOCK_PROVIDERS = OrderedDict(
<ide> [
<ide> (
<ide> 'apache-airflow-providers-amazon',
<del> (
<add> ProviderInfo(
<ide> '1.0.0',
<ide> {
<ide> 'package-name': 'apache-airflow-providers-amazon',
<ide> 'name': 'Amazon',
<ide> 'description': '`Amazon Web Services (AWS) <https://aws.amazon.com/>`__.\n',
<ide> 'versions': ['1.0.0'],
<ide> },
<add> 'package',
<ide> ),
<ide> ),
<ide> (
<ide> 'apache-airflow-providers-apache-cassandra',
<del> (
<add> ProviderInfo(
<ide> '1.0.0',
<ide> {
<ide> 'package-name': 'apache-airflow-providers-apache-cassandra',
<ide> 'name': 'Apache Cassandra',
<ide> 'description': '`Apache Cassandra <http://cassandra.apache.org/>`__.\n',
<ide> 'versions': ['1.0.0'],
<ide> },
<add> 'package',
<ide> ),
<ide> ),
<ide> ] | 5 |
Go | Go | remove some logs from tests | 86970d00bbb9c5e3184fe4e3e7442fd0865c80ec | <ide><path>runtime_test.go
<ide> func TestReloadContainerLinks(t *testing.T) {
<ide> runningCount := 0
<ide> for _, c := range runtime2.List() {
<ide> if c.State.Running {
<del> t.Logf("Running container found: %v (%v)", c.ID, c.Path)
<ide> runningCount++
<ide> }
<ide> }
<ide> func TestReloadContainerLinks(t *testing.T) {
<ide> t.Fatalf("Container 2 %s should be registered first in the runtime", container2.ID)
<ide> }
<ide>
<del> t.Logf("Number of links: %d", runtime2.containerGraph.Refs("0"))
<ide> // Verify that the link is still registered in the runtime
<ide> entity := runtime2.containerGraph.Get(container1.Name)
<ide> if entity == nil { | 1 |
Javascript | Javascript | remove unused var | 469b14a525aad1eb3a0013f9d02c943b649c3392 | <ide><path>src/ng/compile.js
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> // Add the matching elements into their slot
<ide> forEach($compileNode.children(), function(node) {
<ide> var slotName = slotNames[directiveNormalize(nodeName_(node))];
<del> var slot = $template;
<ide> if (slotName) {
<ide> filledSlots[slotName] = true;
<ide> slots[slotName].push(node); | 1 |
Text | Text | update streams wg charter | 0a54b6a134a6815e30d1f78f8c8612d4a00399ad | <ide><path>WORKING_GROUPS.md
<ide> The current members can be found in their
<ide>
<ide> ### Streams
<ide>
<del>The streams working group's purpose is to improve the existing Stream
<del>implementation, in accordance with the communities needs and feedback.
<del>
<del>Its responsibilities are:
<del>* Produce a living `Stream` standard.
<del>* Create a reference implementation as `readable-stream`.
<del>* Recommend versions of `readable-stream` to be included in `io.js`
<del>* Collaborate with the WHATWG Stream standard to ensure an optimal level
<del>of compatibility between the two standards.
<add>The Streams WG is dedicated to the support and improvement of the Streams API
<add>as used in io.js and the npm ecosystem. We seek to create a composable API that
<add>solves the problem of representing multiple occurrences of an event over time
<add>in a humane, low-overhead fashion. Improvements to the API will be driven by
<add>the needs of the ecosystem; interoperability and backwards compatibility with
<add>other solutions and prior versions are paramount in importance. Our
<add>responsibilities include:
<add>
<add>* Addressing stream issues on the io.js issue tracker.
<add>* Authoring and editing stream documentation within the io.js project.
<add>* Reviewing changes to stream subclasses within the io.js project.
<add>* Redirecting changes to streams from the io.js project to this project.
<add>* Assisting in the implementation of stream providers within io.js.
<add>* Recommending versions of readable-stream to be included in io.js.
<add>* Messaging about the future of streams to give the community advance notice of changes.
<ide>
<ide> Initial members are:
<ide> * @chrisdickinson
<ide> * @isaacs
<ide> * @rvagg
<del>* @TooTallNate
<ide> * @Raynos
<ide> * @calvinmetcalf
<del>* @substack
<ide> * @sonewman
<ide> * @mafintosh
<ide> * @timgestson
<del>* @deoxxa
<del>* @maxogden
<del>* @feross
<del>* @mafintosh
<del>* @calvinmetcalf
<del>* @sonewman
<ide> * @domenic
<del>* @timgestson
<del>
<ide>
<ide> ### Build
<ide> | 1 |
Text | Text | add information for incomingmessage.destroy() | 4f2aec307e59dcdc90cb1170b59a2a941325561a | <ide><path>doc/api/http.md
<ide> following additional events, methods, and properties.
<ide> Indicates that the underlying connection was closed.
<ide> Just like `'end'`, this event occurs only once per response.
<ide>
<add>### message.destroy([error])
<add>
<add>* `error` {Error}
<add>
<add>Calls `destroy()` on the socket that received the `IncomingMessage`. If `error`
<add>is provided, an `'error'` event is emitted and `error` is passed as an argument
<add>to any listeners on the event.
<add>
<ide> ### message.headers
<ide>
<ide> The request/response headers object. | 1 |
Text | Text | add note about updating with fill-config | 41292a1b847f64179bc97c8e13543f3a75110485 | <ide><path>website/docs/usage/v3-1.md
<ide> By default, components are updated in isolation during training, which means
<ide> that they don't see the predictions of any earlier components in the pipeline.
<ide> The new
<ide> [`[training.annotating_components]`](/usage/training#annotating-components)
<del>config setting lets you specify pipeline components that should set
<del>annotations on the predicted docs during training. This makes it easy to use the
<del>predictions of a previous component in the pipeline as features for a subsequent
<del>component, e.g. the dependency labels in the tagger:
<add>config setting lets you specify pipeline components that should set annotations
<add>on the predicted docs during training. This makes it easy to use the predictions
<add>of a previous component in the pipeline as features for a subsequent component,
<add>e.g. the dependency labels in the tagger:
<ide>
<ide> ```ini
<ide> ### config.cfg (excerpt) {highlight="7,12"}
<ide> working as expected, you can update the spaCy version requirements in the
<ide> + "spacy_version": ">=3.0.0,<3.2.0",
<ide> ```
<ide>
<add>### Updating v3.0 configs
<add>
<add>To update a config from spaCy v3.0 with the new v3.1 settings, run
<add>[`init fill-config`](/api/cli#init-fill-config):
<add>
<add>```bash
<add>python -m spacy init fill-config config-v3.0.cfg config-v3.1.cfg
<add>```
<add>
<add>In many cases (`spacy train`, `spacy.load()`), the new defaults will be filled
<add>in automatically, but you'll need to fill in the new settings to run
<add>[`debug config`](/api/cli#debug) and [`debug data`](/api/cli#debug-data).
<add>
<ide> ### Sourcing pipeline components with vectors {#source-vectors}
<ide>
<ide> If you're sourcing a pipeline component that requires static vectors (for | 1 |
Javascript | Javascript | fix spacebar scrolling in firefox (4224 follow-up) | 4ee1fb795642b8f7c22b822df6716ee72b138d88 | <ide><path>web/viewer.js
<ide> window.addEventListener('keydown', function keydown(evt) {
<ide> }
<ide> // 32=Spacebar
<ide> if (evt.keyCode === 32 && curElementTagName !== 'BUTTON') {
<del>//#if !(FIREFOX || MOZCENTRAL)
<add>//#if (FIREFOX || MOZCENTRAL)
<ide> //// Workaround for issue in Firefox, that prevents scroll keys from working
<ide> //// when elements with 'tabindex' are focused. (#3499)
<ide> // PDFView.container.blur(); | 1 |
PHP | PHP | improve docblock example | 5e3edad2cd55fdaa392a20a424dc7497d107e806 | <ide><path>src/ORM/Table.php
<ide> public function associations() {
<ide> * as argument:
<ide> *
<ide> * {{{
<del> * $this->Comment->associations([
<add> * $this->Posts->associations([
<ide> * 'belongsTo' => [
<del> * 'Comments',
<ide> * 'Users' => ['className' => 'App\Model\Table\UsersTable']
<ide> * ],
<del> * 'belongsToMany' => [
<del> * 'Tags'
<del> * ]
<add> * 'hasMany' => ['Comments'],
<add> * 'belongsToMany' => ['Tags']
<ide> * ]);
<ide> * }}}
<ide> * | 1 |
Text | Text | update formula-cookbook.md gsub! example | e567d7f595eeed6e2bc4e905e45ddc7b7817bc44 | <ide><path>docs/Formula-Cookbook.md
<ide> inreplace "path", before, after
<ide>
<ide> ```ruby
<ide> inreplace "path" do |s|
<del> s.gsub! /foo/, "bar"
<add> s.gsub!(/foo/, "bar")
<ide> s.gsub! "123", "456"
<ide> end
<ide> ``` | 1 |
Javascript | Javascript | add [contenthash] support | 296542ed79d8f466177ea7777f7f8a5c0b0e65fc | <ide><path>lib/Chunk.js
<ide> class Chunk {
<ide> this.files = [];
<ide> this.rendered = false;
<ide> this.hash = undefined;
<add> this.contentHash = Object.create(null);
<ide> this.renderedHash = undefined;
<ide> this.chunkReason = undefined;
<ide> this.extraAsync = false;
<ide> class Chunk {
<ide>
<ide> getChunkMaps(realHash) {
<ide> const chunkHashMap = Object.create(null);
<add> const chunkContentHashMap = Object.create(null);
<ide> const chunkNameMap = Object.create(null);
<ide>
<ide> for (const chunk of this.getAllAsyncChunks()) {
<ide> chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash;
<add> for (const key of Object.keys(chunk.contentHash)) {
<add> if (!chunkContentHashMap[key])
<add> chunkContentHashMap[key] = Object.create(null);
<add> chunkContentHashMap[key][chunk.id] = chunk.contentHash[key];
<add> }
<ide> if (chunk.name) chunkNameMap[chunk.id] = chunk.name;
<ide> }
<ide>
<ide> return {
<ide> hash: chunkHashMap,
<add> contentHash: chunkContentHashMap,
<ide> name: chunkNameMap
<ide> };
<ide> }
<ide><path>lib/Compilation.js
<ide> class Compilation extends Tapable {
<ide> recordChunks: new SyncHook(["chunks", "records"]),
<ide>
<ide> beforeHash: new SyncHook([]),
<add> contentHash: new SyncHook(["chunk"]),
<ide> afterHash: new SyncHook([]),
<ide>
<ide> recordHash: new SyncHook(["records"]),
<ide> class Compilation extends Tapable {
<ide> const chunkHash = createHash(hashFunction);
<ide> if (outputOptions.hashSalt) chunkHash.update(outputOptions.hashSalt);
<ide> chunk.updateHash(chunkHash);
<del> if (chunk.hasRuntime()) {
<del> this.mainTemplate.updateHashForChunk(chunkHash, chunk);
<del> } else {
<del> this.chunkTemplate.updateHashForChunk(chunkHash, chunk);
<del> }
<add> const template = chunk.hasRuntime()
<add> ? this.mainTemplate
<add> : this.chunkTemplate;
<add> template.updateHashForChunk(chunkHash, chunk);
<ide> this.hooks.chunkHash.call(chunk, chunkHash);
<ide> chunk.hash = chunkHash.digest(hashDigest);
<ide> hash.update(chunk.hash);
<ide> chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
<add> this.hooks.contentHash.call(chunk);
<ide> }
<ide> this.fullHash = hash.digest(hashDigest);
<ide> this.hash = this.fullHash.substr(0, hashDigestLength);
<ide><path>lib/JavascriptModulesPlugin.js
<ide> const Parser = require("./Parser");
<ide> const Template = require("./Template");
<ide> const { ConcatSource } = require("webpack-sources");
<ide> const JavascriptGenerator = require("./JavascriptGenerator");
<add>const createHash = require("./util/createHash");
<ide>
<ide> class JavascriptModulesPlugin {
<ide> apply(compiler) {
<ide> class JavascriptModulesPlugin {
<ide> filenameTemplate,
<ide> pathOptions: {
<ide> noChunkHash: !useChunkHash,
<add> contentHashType: "javascript",
<ide> chunk
<ide> },
<ide> identifier: `chunk${chunk.id}`,
<ide> class JavascriptModulesPlugin {
<ide> ),
<ide> filenameTemplate,
<ide> pathOptions: {
<del> chunk
<add> chunk,
<add> contentHashType: "javascript"
<ide> },
<ide> identifier: `chunk${chunk.id}`,
<ide> hash: chunk.hash
<ide> class JavascriptModulesPlugin {
<ide> return result;
<ide> }
<ide> );
<add> compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => {
<add> const outputOptions = compilation.outputOptions;
<add> const hashFunction = outputOptions.hashFunction;
<add> const hashSalt = outputOptions.hashSalt;
<add> const hashDigest = outputOptions.hashDigest;
<add> const hashDigestLength = outputOptions.hashDigestLength;
<add> const hash = createHash(hashFunction);
<add> if (hashSalt) hash.update(hashSalt);
<add> const template = chunk.hasRuntime()
<add> ? compilation.mainTemplate
<add> : compilation.chunkTemplate;
<add> template.updateHashForChunk(hash, chunk);
<add> for (const m of chunk.modulesIterable) {
<add> if (typeof m.source === "function") {
<add> hash.update(m.hash);
<add> }
<add> }
<add> chunk.contentHash.javascript = hash
<add> .digest(hashDigest)
<add> .substr(0, hashDigestLength);
<add> });
<ide> }
<ide> );
<ide> }
<ide><path>lib/SourceMapDevToolPlugin.js
<ide> class SourceMapDevToolPlugin {
<ide> ? path.relative(options.fileContext, filename)
<ide> : filename,
<ide> query,
<del> basename: basename(filename)
<add> basename: basename(filename),
<add> contentHash: createHash("md4")
<add> .update(sourceMapString)
<add> .digest("hex")
<ide> });
<del> if (sourceMapFile.includes("[contenthash]")) {
<del> sourceMapFile = sourceMapFile.replace(
<del> /\[contenthash\]/g,
<del> createHash("md4")
<del> .update(sourceMapString)
<del> .digest("hex")
<del> );
<del> }
<ide> const sourceMapUrl = options.publicPath
<ide> ? options.publicPath + sourceMapFile.replace(/\\/g, "/")
<ide> : path
<ide><path>lib/TemplatedPathPlugin.js
<ide> const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi,
<ide> REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi,
<ide> REGEXP_MODULEHASH = /\[modulehash(?::(\d+))?\]/gi,
<add> REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/gi,
<ide> REGEXP_NAME = /\[name\]/gi,
<ide> REGEXP_ID = /\[id\]/gi,
<ide> REGEXP_MODULEID = /\[moduleid\]/gi,
<ide> const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi,
<ide> // We use a normal RegExp instead of .test
<ide> const REGEXP_HASH_FOR_TEST = new RegExp(REGEXP_HASH.source, "i"),
<ide> REGEXP_CHUNKHASH_FOR_TEST = new RegExp(REGEXP_CHUNKHASH.source, "i"),
<add> REGEXP_CONTENTHASH_FOR_TEST = new RegExp(REGEXP_CONTENTHASH.source, "i"),
<ide> REGEXP_NAME_FOR_TEST = new RegExp(REGEXP_NAME.source, "i");
<ide>
<ide> const withHashLength = (replacer, handlerFn) => {
<ide> const replacePathVariables = (path, data) => {
<ide> const chunkName = chunk && (chunk.name || chunk.id);
<ide> const chunkHash = chunk && (chunk.renderedHash || chunk.hash);
<ide> const chunkHashWithLength = chunk && chunk.hashWithLength;
<add> const contentHashType = data.contentHashType;
<add> const contentHash =
<add> (chunk && chunk.contentHash && chunk.contentHash[contentHashType]) ||
<add> data.contentHash;
<add> const contentHashWithLength =
<add> (chunk &&
<add> chunk.contentHashWithLength &&
<add> chunk.contentHashWithLength[contentHashType]) ||
<add> data.contentHashWithLength;
<ide> const module = data.module;
<ide> const moduleId = module && module.id;
<ide> const moduleHash = module && (module.renderedHash || module.hash);
<ide> const replacePathVariables = (path, data) => {
<ide> path = path(data);
<ide> }
<ide>
<del> if (data.noChunkHash && REGEXP_CHUNKHASH_FOR_TEST.test(path)) {
<add> if (
<add> data.noChunkHash &&
<add> (REGEXP_CHUNKHASH_FOR_TEST.test(path) ||
<add> REGEXP_CONTENTHASH_FOR_TEST.test(path))
<add> ) {
<ide> throw new Error(
<del> `Cannot use [chunkhash] for chunk in '${path}' (use [hash] instead)`
<add> `Cannot use [chunkhash] or [contenthash] for chunk in '${
<add> path
<add> }' (use [hash] instead)`
<ide> );
<ide> }
<ide>
<ide> const replacePathVariables = (path, data) => {
<ide> REGEXP_CHUNKHASH,
<ide> withHashLength(getReplacer(chunkHash), chunkHashWithLength)
<ide> )
<add> .replace(
<add> REGEXP_CONTENTHASH,
<add> withHashLength(getReplacer(contentHash), contentHashWithLength)
<add> )
<ide> .replace(
<ide> REGEXP_MODULEHASH,
<ide> withHashLength(getReplacer(moduleHash), moduleHashWithLength)
<ide> class TemplatedPathPlugin {
<ide> if (
<ide> REGEXP_HASH_FOR_TEST.test(publicPath) ||
<ide> REGEXP_CHUNKHASH_FOR_TEST.test(publicPath) ||
<add> REGEXP_CONTENTHASH_FOR_TEST.test(publicPath) ||
<ide> REGEXP_NAME_FOR_TEST.test(publicPath)
<ide> )
<ide> return true;
<ide> class TemplatedPathPlugin {
<ide> outputOptions.chunkFilename || outputOptions.filename;
<ide> if (REGEXP_CHUNKHASH_FOR_TEST.test(chunkFilename))
<ide> hash.update(JSON.stringify(chunk.getChunkMaps(true).hash));
<add> if (REGEXP_CONTENTHASH_FOR_TEST.test(chunkFilename)) {
<add> hash.update(
<add> JSON.stringify(chunk.getChunkMaps(true).contentHash.javascript)
<add> );
<add> }
<ide> if (REGEXP_NAME_FOR_TEST.test(chunkFilename))
<ide> hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
<ide> }
<ide><path>lib/node/NodeMainTemplatePlugin.js
<ide> module.exports = class NodeMainTemplatePlugin {
<ide> shortChunkHashMap
<ide> )}[chunkId] + "`;
<ide> },
<add> contentHash: {
<add> javascript: `" + ${JSON.stringify(
<add> chunkMaps.contentHash.javascript
<add> )}[chunkId] + "`
<add> },
<add> contentHashWithLength: {
<add> javascript: length => {
<add> const shortContentHashMap = {};
<add> const contentHash =
<add> chunkMaps.contentHash.javascript;
<add> for (const chunkId of Object.keys(contentHash)) {
<add> if (typeof contentHash[chunkId] === "string") {
<add> shortContentHashMap[chunkId] = contentHash[
<add> chunkId
<add> ].substr(0, length);
<add> }
<add> }
<add> return `" + ${JSON.stringify(
<add> shortContentHashMap
<add> )}[chunkId] + "`;
<add> }
<add> },
<ide> name: `" + (${JSON.stringify(
<ide> chunkMaps.name
<ide> )}[chunkId]||chunkId) + "`
<del> }
<add> },
<add> contentHashType: "javascript"
<ide> }
<ide> ) +
<ide> ";",
<ide> module.exports = class NodeMainTemplatePlugin {
<ide> shortChunkHashMap
<ide> )}[chunkId] + "`;
<ide> },
<add> contentHash: {
<add> javascript: `" + ${JSON.stringify(
<add> chunkMaps.contentHash.javascript
<add> )}[chunkId] + "`
<add> },
<add> contentHashWithLength: {
<add> javascript: length => {
<add> const shortContentHashMap = {};
<add> const contentHash = chunkMaps.contentHash.javascript;
<add> for (const chunkId of Object.keys(contentHash)) {
<add> if (typeof contentHash[chunkId] === "string") {
<add> shortContentHashMap[chunkId] = contentHash[
<add> chunkId
<add> ].substr(0, length);
<add> }
<add> }
<add> return `" + ${JSON.stringify(
<add> shortContentHashMap
<add> )}[chunkId] + "`;
<add> }
<add> },
<ide> name: `" + (${JSON.stringify(
<ide> chunkMaps.name
<ide> )}[chunkId]||chunkId) + "`
<del> }
<add> },
<add> contentHashType: "javascript"
<ide> }
<ide> );
<ide> return Template.asString([
<ide><path>lib/web/JsonpMainTemplatePlugin.js
<ide> class JsonpMainTemplatePlugin {
<ide> },
<ide> name: `" + (${JSON.stringify(
<ide> chunkMaps.name
<del> )}[chunkId]||chunkId) + "`
<del> }
<add> )}[chunkId]||chunkId) + "`,
<add> contentHash: {
<add> javascript: `" + ${JSON.stringify(
<add> chunkMaps.contentHash.javascript
<add> )}[chunkId] + "`
<add> },
<add> contentHashWithLength: {
<add> javascript: length => {
<add> const shortContentHashMap = {};
<add> const contentHash = chunkMaps.contentHash.javascript;
<add> for (const chunkId of Object.keys(contentHash)) {
<add> if (typeof contentHash[chunkId] === "string") {
<add> shortContentHashMap[chunkId] = contentHash[
<add> chunkId
<add> ].substr(0, length);
<add> }
<add> }
<add> return `" + ${JSON.stringify(
<add> shortContentHashMap
<add> )}[chunkId] + "`;
<add> }
<add> }
<add> },
<add> contentHashType: "javascript"
<ide> }
<ide> );
<ide> return Template.asString([
<ide><path>lib/webpack.js
<ide> exportPlugins((exports.node = {}), {
<ide> exportPlugins((exports.debug = {}), {
<ide> ProfilingPlugin: () => require("./debug/ProfilingPlugin")
<ide> });
<add>exportPlugins((exports.util = {}), {
<add> createHash: () => require("./util/createHash")
<add>});
<ide>
<ide> const defineMissingPluginError = (namespace, pluginName, errorMessage) => {
<ide> Reflect.defineProperty(namespace, pluginName, {
<ide><path>lib/webworker/WebWorkerMainTemplatePlugin.js
<ide> class WebWorkerMainTemplatePlugin {
<ide> "WebWorkerMainTemplatePlugin",
<ide> (_, chunk, hash) => {
<ide> const chunkFilename = mainTemplate.outputOptions.chunkFilename;
<add> const chunkMaps = chunk.getChunkMaps();
<ide> return Template.asString([
<ide> "promises.push(Promise.resolve().then(function() {",
<ide> Template.indent([
<ide> class WebWorkerMainTemplatePlugin {
<ide> )} + "`,
<ide> chunk: {
<ide> id: '" + chunkId + "'
<del> }
<add> },
<add> contentHash: {
<add> javascript: `" + ${JSON.stringify(
<add> chunkMaps.contentHash.javascript
<add> )}[chunkId] + "`
<add> },
<add> contentHashWithLength: {
<add> javascript: length => {
<add> const shortContentHashMap = {};
<add> const contentHash = chunkMaps.contentHash.javascript;
<add> for (const chunkId of Object.keys(contentHash)) {
<add> if (typeof contentHash[chunkId] === "string") {
<add> shortContentHashMap[chunkId] = contentHash[
<add> chunkId
<add> ].substr(0, length);
<add> }
<add> }
<add> return `" + ${JSON.stringify(
<add> shortContentHashMap
<add> )}[chunkId] + "`;
<add> }
<add> },
<add> contentHashType: "javascript"
<ide> }) +
<ide> ");"
<ide> ]),
<ide><path>test/configCases/hash-length/output-filename/webpack.config.js
<ide> module.exports = [
<ide> expectedFilenameLength: 31,
<ide> expectedChunkFilenameLength: 20
<ide> }
<add> },
<add> {
<add> name: "contenthash in node",
<add> output: {
<add> filename: "bundle10.[contenthash].js",
<add> chunkFilename: "[id].bundle10.[contenthash].js"
<add> },
<add> target: "node",
<add> amd: {
<add> expectedFilenameLength: 32,
<add> expectedChunkFilenameLength: 34
<add> }
<add> },
<add> {
<add> name: "contenthash in node with length",
<add> output: {
<add> filename: "bundle11.[contenthash:7].js",
<add> chunkFilename: "[id].bundle11.[contenthash:7].js"
<add> },
<add> target: "node",
<add> amd: {
<add> expectedFilenameLength: 9 + 7 + 3,
<add> expectedChunkFilenameLength: 2 + 9 + 7 + 3
<add> }
<ide> }
<ide> ];
<ide> | 10 |
PHP | PHP | throw better exceptions | 58638216e89d8b33e0c0e9879564135ba53ca15f | <ide><path>laravel/asset.php
<ide> protected function dependency_is_valid($asset, $dependency, $original, $assets)
<ide>
<ide> if ($dependency === $asset)
<ide> {
<del> throw new \Exception("Asset [$asset] is dependent on itself.");
<add> throw new \LogicException("Asset [$asset] is dependent on itself.");
<ide> }
<ide> elseif (isset($assets[$dependency]) and in_array($asset, $assets[$dependency]['dependencies']))
<ide> {
<del> throw new \Exception("Assets [$asset] and [$dependency] have a circular dependency.");
<add> throw new \LogicException("Assets [$asset] and [$dependency] have a circular dependency.");
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/cache/manager.php
<ide> protected static function factory($driver)
<ide> return new Drivers\Redis(Redis::db());
<ide>
<ide> default:
<del> throw new \Exception("Cache driver {$driver} is not supported.");
<add> throw new \DomainException("Cache driver {$driver} is not supported.");
<ide> }
<ide> }
<ide>
<ide><path>laravel/cookie.php
<ide>
<ide> if (trim(Config::$items['application']['key']) === '')
<ide> {
<del> throw new \Exception('The cookie class may not be used without an application key.');
<add> throw new \LogicException('The cookie class may not be used without an application key.');
<ide> }
<ide>
<ide> class Cookie {
<ide> public static function forget($name)
<ide> return static::put($name, null, -2000);
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/crypter.php
<ide>
<ide> if (trim(Config::$items['application']['key']) === '')
<ide> {
<del> throw new \Exception('The encryption class may not be used without an application key.');
<add> throw new \LogicException('The encryption class may not be used without an application key.');
<ide> }
<ide>
<ide> class Crypter {
<ide> public static function decrypt($value)
<ide> {
<ide> if (($value = base64_decode($value)) === false)
<ide> {
<del> throw new \Exception('Decryption error. Input value is not valid base64 data.');
<add> throw new \InvalidArgumentException('Decryption error. Input value is not valid base64 data.');
<ide> }
<ide>
<ide> $iv = substr($value, 0, static::iv_size());
<ide> protected static function key()
<ide> return Config::$items['application']['key'];
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/database/connectors/sqlite.php
<ide> public function connect($config)
<ide> return new PDO('sqlite:'.$config['database'], null, null, $options);
<ide> }
<ide>
<del> throw new \Exception("SQLite database [{$config['database']}] could not be found.");
<add> throw new \OutOfBoundsException("SQLite database [{$config['database']}] could not be found.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/database/eloquent/hydrator.php
<ide> public static function hydrate($eloquent)
<ide> {
<ide> if ( ! method_exists($eloquent, $include))
<ide> {
<del> throw new \Exception("Attempting to eager load [$include], but the relationship is not defined.");
<add> throw new \LogicException("Attempting to eager load [$include], but the relationship is not defined.");
<ide> }
<ide>
<ide> static::eagerly($eloquent, $results, $include);
<ide> private static function has_and_belongs_to_many($relationship, &$parents, $relat
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/database/manager.php
<ide> public static function connection($connection = null)
<ide>
<ide> if (is_null($config))
<ide> {
<del> throw new \Exception("Database connection is not defined for connection [$connection].");
<add> throw new \OutOfBoundsException("Database connection is not defined for connection [$connection].");
<ide> }
<ide>
<ide> static::$connections[$connection] = new Connection(static::connect($config), $config);
<ide> protected static function connector($driver)
<ide> return new Connectors\Postgres;
<ide>
<ide> default:
<del> throw new \Exception("Database driver [$driver] is not supported.");
<add> throw new \DomainException("Database driver [$driver] is not supported.");
<ide> }
<ide> }
<ide>
<ide> public static function __callStatic($method, $parameters)
<ide> return call_user_func_array(array(static::connection(), $method), $parameters);
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/database/query.php
<ide> public function __call($method, $parameters)
<ide> }
<ide> }
<ide>
<del> throw new \Exception("Method [$method] is not defined on the Query class.");
<add> throw new \BadMethodCallException("Method [$method] is not defined on the Query class.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/html.php
<ide> public static function __callStatic($method, $parameters)
<ide> return forward_static_call_array('HTML::link_to_route', $parameters);
<ide> }
<ide>
<del> throw new \Exception("Method [$method] is not defined on the HTML class.");
<add> throw new \BadMethodCallException("Method [$method] is not defined on the HTML class.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/input.php
<ide> public static function old($key = null, $default = null)
<ide> {
<ide> if (Config::get('session.driver') == '')
<ide> {
<del> throw new \Exception('A session driver must be specified in order to access old input.');
<add> throw new \UnexpectedValueException('A session driver must be specified in order to access old input.');
<ide> }
<ide>
<ide> $old = IoC::core('session')->get(Input::old_input, array());
<ide><path>laravel/ioc.php
<ide> public static function resolve($name, $parameters = array())
<ide>
<ide> if ( ! static::registered($name))
<ide> {
<del> throw new \Exception("Error resolving [$name]. No resolver has been registered in the container.");
<add> throw new \OutOfBoundsException("Error resolving [$name]. No resolver has been registered in the container.");
<ide> }
<ide>
<ide> $object = call_user_func(static::$registry[$name]['resolver'], $parameters);
<ide> public static function resolve($name, $parameters = array())
<ide> * loaded since there isn't any reason to load the container
<ide> * configuration until the class is first requested.
<ide> */
<del>IoC::bootstrap();
<ide>\ No newline at end of file
<add>IoC::bootstrap();
<ide><path>laravel/lang.php
<ide> protected function parse($key)
<ide> return array($segments[0], implode('.', array_slice($segments, 1)));
<ide> }
<ide>
<del> throw new \Exception("Invalid language line [$key]. A specific line must be specified.");
<add> throw new \InvalidArgumentException("Invalid language line [$key]. A specific line must be specified.");
<ide> }
<ide>
<ide> /**
<ide> public function __toString()
<ide> return $this->get();
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/memcached.php
<ide> public static function connect($servers)
<ide>
<ide> if ($memcache->getVersion() === false)
<ide> {
<del> throw new \Exception('Could not establish memcached connection. Please verify your configuration.');
<add> throw new \RuntimeException('Could not establish memcached connection. Please verify your configuration.');
<ide> }
<ide>
<ide> return $memcache;
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/redirect.php
<ide> public function with($key, $value)
<ide> {
<ide> if (Config::get('session.driver') == '')
<ide> {
<del> throw new \Exception('A session driver must be set before setting flash data.');
<add> throw new \LogicException('A session driver must be set before setting flash data.');
<ide> }
<ide>
<ide> IoC::core('session')->flash($key, $value);
<ide> public static function __callStatic($method, $parameters)
<ide> return static::to(URL::to_route(substr($method, 3), $parameters), $status);
<ide> }
<ide>
<del> throw new \Exception("Method [$method] is not defined on the Redirect class.");
<add> throw new \BadMethodCallException("Method [$method] is not defined on the Redirect class.");
<ide> }
<ide>
<ide> }
<ide><path>laravel/redis.php
<ide> public static function db($name = 'default')
<ide> {
<ide> if (is_null($config = Config::get("database.redis.{$name}")))
<ide> {
<del> throw new \Exception("Redis database [$name] is not defined.");
<add> throw new \DomainException("Redis database [$name] is not defined.");
<ide> }
<ide>
<ide> static::$databases[$name] = new static($config['host'], $config['port']);
<ide> public function run($method, $parameters)
<ide> switch (substr($ersponse, 0, 1))
<ide> {
<ide> case '-':
<del> throw new \Exception('Redis error: '.substr(trim($ersponse), 4));
<add> throw new \RuntimeException('Redis error: '.substr(trim($ersponse), 4));
<ide>
<ide> case '+':
<ide> case ':':
<ide> public function run($method, $parameters)
<ide> return $this->multibulk($ersponse);
<ide>
<ide> default:
<del> throw new \Exception("Unknown response from Redis server: ".substr($ersponse, 0, 1));
<add> throw new \UnexpectedValueException("Unknown response from Redis server: ".substr($ersponse, 0, 1));
<ide> }
<ide> }
<ide>
<ide> protected function connect()
<ide>
<ide> if ($this->connection === false)
<ide> {
<del> throw new \Exception("Error making Redis connection: {$error} - {$message}");
<add> throw new \RuntimeException("Error making Redis connection: {$error} - {$message}");
<ide> }
<ide>
<ide> return $this->connection;
<ide> public function __destruct()
<ide> fclose($this->connection);
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/routing/controller.php
<ide> public static function call($destination, $parameters = array())
<ide> {
<ide> if (strpos($destination, '@') === false)
<ide> {
<del> throw new \Exception("Route delegate [{$destination}] has an invalid format.");
<add> throw new \InvalidArgumentException("Route delegate [{$destination}] has an invalid format.");
<ide> }
<ide>
<ide> list($controller, $method) = explode('@', $destination);
<ide> public function __get($key)
<ide> return IoC::resolve($key);
<ide> }
<ide>
<del> throw new \Exception("Attempting to access undefined property [$key] on controller.");
<add> throw new \OutOfBoundsException("Attempting to access undefined property [$key] on controller.");
<ide> }
<ide>
<ide> }
<ide><path>laravel/routing/route.php
<ide> public function __construct($key, $callback, $parameters = array())
<ide>
<ide> if ( ! $callback instanceof Closure and ! is_array($callback) and ! is_string($callback))
<ide> {
<del> throw new \Exception('Invalid route defined for URI ['.$this->key.']');
<add> throw new \InvalidArgumentException('Invalid route defined for URI ['.$this->key.']');
<ide> }
<ide> }
<ide>
<ide> public function __call($method, $parameters)
<ide> return $this->is(substr($method, 3));
<ide> }
<ide>
<del> throw new \Exception("Call to undefined method [$method] on Route class.");
<add> throw new \BadMethodCallException("Call to undefined method [$method] on Route class.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/session/drivers/factory.php
<ide> public static function make($driver)
<ide> return new Redis(Cache::driver('redis'));
<ide>
<ide> default:
<del> throw new \Exception("Session driver [$driver] is not supported.");
<add> throw new \DomainException("Session driver [$driver] is not supported.");
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/session/payload.php
<ide>
<ide> if (Config::$items['application']['key'] === '')
<ide> {
<del> throw new \Exception("An application key is required to use sessions.");
<add> throw new \LogicException("An application key is required to use sessions.");
<ide> }
<ide>
<ide> class Payload {
<ide> protected function cookie()
<ide> Cookie::put($cookie, $this->session['id'], $minutes, $path, $domain, $secure);
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/str.php
<ide> protected static function pool($type)
<ide> return '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
<ide>
<ide> default:
<del> throw new \Exception("Invalid random string type [$type].");
<add> throw new \DomainException("Invalid random string type [$type].");
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/url.php
<ide> public static function to_route($name, $parameters = array(), $https = false)
<ide> return static::to(str_replace(array('/(:any?)', '/(:num?)'), '', $uri), $https);
<ide> }
<ide>
<del> throw new \Exception("Error generating named route for route [$name]. Route is not defined.");
<add> throw new \OutOfBoundsException("Error generating named route for route [$name]. Route is not defined.");
<ide> }
<ide>
<ide> /**
<ide> public static function __callStatic($method, $parameters)
<ide> return static::to_route(substr($method, 3), $parameters);
<ide> }
<ide>
<del> throw new \Exception("Method [$method] is not defined on the URL class.");
<add> throw new \BadMethodCallException("Method [$method] is not defined on the URL class.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/validator.php
<ide> public function __call($method, $parameters)
<ide> return call_user_func_array(static::$validators[$method], $parameters);
<ide> }
<ide>
<del> throw new \Exception("Call to undefined method [$method] on Validator instance.");
<add> throw new \BadMethodCallException("Call to undefined method [$method] on Validator instance.");
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>laravel/view.php
<ide> protected function path($view)
<ide> }
<ide> }
<ide>
<del> throw new \Exception("View [$view] does not exist.");
<add> throw new \RuntimeException("View [$view] does not exist.");
<ide> }
<ide>
<ide> /**
<ide> public static function of($name, $data = array())
<ide> return static::make($view, $data);
<ide> }
<ide>
<del> throw new \Exception("Named view [$name] is not defined.");
<add> throw new \OutOfBoundsException("Named view [$name] is not defined.");
<ide> }
<ide>
<ide> /**
<ide> public static function __callStatic($method, $parameters)
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>} | 23 |
Text | Text | fix sponsor images for mkdocs | 2fe6709769048944127c8c48af4364101914e690 | <ide><path>docs/topics/kickstarter-announcement.md
<ide> We've now blazed way past all our goals, with a staggering £30,000 (~$50,000),
<ide> Our platinum sponsors have each made a hugely substantial contribution to the future development of Django REST framework, and I simply can't thank them enough.
<ide>
<ide> <ul class="sponsor diamond">
<del><li><a href="https://www.eventbrite.com/" rel="nofollow" style="background-image:url(../img/sponsors/0-eventbrite.png);">Eventbrite</a></li>
<add><li><a href="https://www.eventbrite.com/" rel="nofollow" style="background-image:url(../../img/sponsors//0-eventbrite.png);">Eventbrite</a></li>
<ide> </ul>
<ide>
<ide> <ul class="sponsor platinum">
<del><li><a href="https://www.divio.ch/" rel="nofollow" style="background-image:url(../img/sponsors/1-divio.png);">Divio</a></li>
<del><li><a href="http://company.onlulu.com/en/" rel="nofollow" style="background-image:url(../img/sponsors/1-lulu.png);">Lulu</a></li>
<del><li><a href="https://p.ota.to/" rel="nofollow" style="background-image:url(../img/sponsors/1-potato.png);">Potato</a></li>
<del><li><a href="http://www.wiredrive.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-wiredrive.png);">Wiredrive</a></li>
<del><li><a href="http://www.cyaninc.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-cyan.png);">Cyan</a></li>
<del><li><a href="https://www.runscope.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-runscope.png);">Runscope</a></li>
<del><li><a href="http://simpleenergy.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-simple-energy.png);">Simple Energy</a></li>
<del><li><a href="http://vokalinteractive.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-vokal_interactive.png);">VOKAL Interactive</a></li>
<del><li><a href="http://www.purplebit.com/" rel="nofollow" style="background-image:url(../img/sponsors/1-purplebit.png);">Purple Bit</a></li>
<del><li><a href="http://www.kuwaitnet.net/" rel="nofollow" style="background-image:url(../img/sponsors/1-kuwaitnet.png);">KuwaitNET</a></li>
<add><li><a href="https://www.divio.ch/" rel="nofollow" style="background-image:url(../../img/sponsors//1-divio.png);">Divio</a></li>
<add><li><a href="http://company.onlulu.com/en/" rel="nofollow" style="background-image:url(../../img/sponsors//1-lulu.png);">Lulu</a></li>
<add><li><a href="https://p.ota.to/" rel="nofollow" style="background-image:url(../../img/sponsors//1-potato.png);">Potato</a></li>
<add><li><a href="http://www.wiredrive.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-wiredrive.png);">Wiredrive</a></li>
<add><li><a href="http://www.cyaninc.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-cyan.png);">Cyan</a></li>
<add><li><a href="https://www.runscope.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-runscope.png);">Runscope</a></li>
<add><li><a href="http://simpleenergy.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-simple-energy.png);">Simple Energy</a></li>
<add><li><a href="http://vokalinteractive.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-vokal_interactive.png);">VOKAL Interactive</a></li>
<add><li><a href="http://www.purplebit.com/" rel="nofollow" style="background-image:url(../../img/sponsors//1-purplebit.png);">Purple Bit</a></li>
<add><li><a href="http://www.kuwaitnet.net/" rel="nofollow" style="background-image:url(../../img/sponsors//1-kuwaitnet.png);">KuwaitNET</a></li>
<ide> </ul>
<ide>
<ide> <div style="clear: both"></div>
<ide> Our platinum sponsors have each made a hugely substantial contribution to the fu
<ide> Our gold sponsors include companies large and small. Many thanks for their significant funding of the project and their commitment to sustainable open-source development.
<ide>
<ide> <ul class="sponsor gold">
<del><li><a href="https://laterpay.net/" rel="nofollow" style="background-image:url(../img/sponsors/2-laterpay.png);">LaterPay</a></li>
<del><li><a href="https://www.schubergphilis.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-schuberg_philis.png);">Schuberg Philis</a></li>
<del><li><a href="http://prorenata.se/" rel="nofollow" style="background-image:url(../img/sponsors/2-prorenata.png);">ProReNata AB</a></li>
<del><li><a href="https://www.sgawebsites.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-sga.png);">SGA Websites</a></li>
<del><li><a href="http://www.sirono.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-sirono.png);">Sirono</a></li>
<del><li><a href="http://www.vinta.com.br/" rel="nofollow" style="background-image:url(../img/sponsors/2-vinta.png);">Vinta Software Studio</a></li>
<del><li><a href="http://www.rapasso.nl/index.php/en" rel="nofollow" style="background-image:url(../img/sponsors/2-rapasso.png);">Rapasso</a></li>
<del><li><a href="https://mirusresearch.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-mirus_research.png);">Mirus Research</a></li>
<del><li><a href="http://hipolabs.com" rel="nofollow" style="background-image:url(../img/sponsors/2-hipo.png);">Hipo</a></li>
<del><li><a href="http://www.byte.nl" rel="nofollow" style="background-image:url(../img/sponsors/2-byte.png);">Byte</a></li>
<del><li><a href="http://lightningkite.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-lightning_kite.png);">Lightning Kite</a></li>
<del><li><a href="https://opbeat.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-opbeat.png);">Opbeat</a></li>
<del><li><a href="https://koordinates.com" rel="nofollow" style="background-image:url(../img/sponsors/2-koordinates.png);">Koordinates</a></li>
<del><li><a href="http://pulsecode.ca" rel="nofollow" style="background-image:url(../img/sponsors/2-pulsecode.png);">Pulsecode Inc.</a></li>
<del><li><a href="http://singinghorsestudio.com" rel="nofollow" style="background-image:url(../img/sponsors/2-singing-horse.png);">Singing Horse Studio Ltd.</a></li>
<del><li><a href="https://www.heroku.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-heroku.png);">Heroku</a></li>
<del><li><a href="https://www.galileo-press.de/" rel="nofollow" style="background-image:url(../img/sponsors/2-galileo_press.png);">Galileo Press</a></li>
<del><li><a href="http://www.securitycompass.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-security_compass.png);">Security Compass</a></li>
<del><li><a href="https://www.djangoproject.com/foundation/" rel="nofollow" style="background-image:url(../img/sponsors/2-django.png);">Django Software Foundation</a></li>
<del><li><a href="http://www.hipflaskapp.com" rel="nofollow" style="background-image:url(../img/sponsors/2-hipflask.png);">Hipflask</a></li>
<del><li><a href="http://www.crate.io/" rel="nofollow" style="background-image:url(../img/sponsors/2-crate.png);">Crate</a></li>
<del><li><a href="http://crypticocorp.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-cryptico.png);">Cryptico Corp</a></li>
<del><li><a href="http://www.nexthub.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-nexthub.png);">NextHub</a></li>
<del><li><a href="https://www.compile.com/" rel="nofollow" style="background-image:url(../img/sponsors/2-compile.png);">Compile</a></li>
<del><li><a href="http://wusawork.org" rel="nofollow" style="background-image:url(../img/sponsors/2-wusawork.png);">WusaWork</a></li>
<add><li><a href="https://laterpay.net/" rel="nofollow" style="background-image:url(../../img/sponsors//2-laterpay.png);">LaterPay</a></li>
<add><li><a href="https://www.schubergphilis.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-schuberg_philis.png);">Schuberg Philis</a></li>
<add><li><a href="http://prorenata.se/" rel="nofollow" style="background-image:url(../../img/sponsors//2-prorenata.png);">ProReNata AB</a></li>
<add><li><a href="https://www.sgawebsites.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-sga.png);">SGA Websites</a></li>
<add><li><a href="http://www.sirono.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-sirono.png);">Sirono</a></li>
<add><li><a href="http://www.vinta.com.br/" rel="nofollow" style="background-image:url(../../img/sponsors//2-vinta.png);">Vinta Software Studio</a></li>
<add><li><a href="http://www.rapasso.nl/index.php/en" rel="nofollow" style="background-image:url(../../img/sponsors//2-rapasso.png);">Rapasso</a></li>
<add><li><a href="https://mirusresearch.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-mirus_research.png);">Mirus Research</a></li>
<add><li><a href="http://hipolabs.com" rel="nofollow" style="background-image:url(../../img/sponsors//2-hipo.png);">Hipo</a></li>
<add><li><a href="http://www.byte.nl" rel="nofollow" style="background-image:url(../../img/sponsors//2-byte.png);">Byte</a></li>
<add><li><a href="http://lightningkite.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-lightning_kite.png);">Lightning Kite</a></li>
<add><li><a href="https://opbeat.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-opbeat.png);">Opbeat</a></li>
<add><li><a href="https://koordinates.com" rel="nofollow" style="background-image:url(../../img/sponsors//2-koordinates.png);">Koordinates</a></li>
<add><li><a href="http://pulsecode.ca" rel="nofollow" style="background-image:url(../../img/sponsors//2-pulsecode.png);">Pulsecode Inc.</a></li>
<add><li><a href="http://singinghorsestudio.com" rel="nofollow" style="background-image:url(../../img/sponsors//2-singing-horse.png);">Singing Horse Studio Ltd.</a></li>
<add><li><a href="https://www.heroku.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-heroku.png);">Heroku</a></li>
<add><li><a href="https://www.galileo-press.de/" rel="nofollow" style="background-image:url(../../img/sponsors//2-galileo_press.png);">Galileo Press</a></li>
<add><li><a href="http://www.securitycompass.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-security_compass.png);">Security Compass</a></li>
<add><li><a href="https://www.djangoproject.com/foundation/" rel="nofollow" style="background-image:url(../../img/sponsors//2-django.png);">Django Software Foundation</a></li>
<add><li><a href="http://www.hipflaskapp.com" rel="nofollow" style="background-image:url(../../img/sponsors//2-hipflask.png);">Hipflask</a></li>
<add><li><a href="http://www.crate.io/" rel="nofollow" style="background-image:url(../../img/sponsors//2-crate.png);">Crate</a></li>
<add><li><a href="http://crypticocorp.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-cryptico.png);">Cryptico Corp</a></li>
<add><li><a href="http://www.nexthub.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-nexthub.png);">NextHub</a></li>
<add><li><a href="https://www.compile.com/" rel="nofollow" style="background-image:url(../../img/sponsors//2-compile.png);">Compile</a></li>
<add><li><a href="http://wusawork.org" rel="nofollow" style="background-image:url(../../img/sponsors//2-wusawork.png);">WusaWork</a></li>
<ide> <li><a href="http://envisionlinux.org/blog" rel="nofollow">Envision Linux</a></li>
<ide> </ul>
<ide>
<ide> Our gold sponsors include companies large and small. Many thanks for their signi
<ide> The serious financial contribution that our silver sponsors have made is very much appreciated. I'd like to say a particular thank you to individuals who have choosen to privately support the project at this level.
<ide>
<ide> <ul class="sponsor silver">
<del><li><a href="http://www.imtapps.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-imt_computer_services.png);">IMT Computer Services</a></li>
<del><li><a href="http://wildfish.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-wildfish.png);">Wildfish</a></li>
<del><li><a href="http://www.thermondo.de/" rel="nofollow" style="background-image:url(../img/sponsors/3-thermondo-gmbh.png);">Thermondo GmbH</a></li>
<del><li><a href="http://providenz.fr/" rel="nofollow" style="background-image:url(../img/sponsors/3-providenz.png);">Providenz</a></li>
<del><li><a href="https://www.alwaysdata.com" rel="nofollow" style="background-image:url(../img/sponsors/3-alwaysdata.png);">alwaysdata.com</a></li>
<del><li><a href="http://www.triggeredmessaging.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-triggered_messaging.png);">Triggered Messaging</a></li>
<del><li><a href="https://www.ipushpull.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-ipushpull.png);">PushPull Technology Ltd</a></li>
<del><li><a href="http://www.transcode.de/" rel="nofollow" style="background-image:url(../img/sponsors/3-transcode.png);">Transcode</a></li>
<del><li><a href="https://garfo.io/" rel="nofollow" style="background-image:url(../img/sponsors/3-garfo.png);">Garfo</a></li>
<del><li><a href="https://goshippo.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-shippo.png);">Shippo</a></li>
<del><li><a href="http://www.gizmag.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-gizmag.png);">Gizmag</a></li>
<del><li><a href="http://www.tivix.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-tivix.png);">Tivix</a></li>
<del><li><a href="http://www.safaribooksonline.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-safari.png);">Safari</a></li>
<del><li><a href="http://brightloop.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-brightloop.png);">Bright Loop</a></li>
<del><li><a href="http://www.aba-systems.com.au/" rel="nofollow" style="background-image:url(../img/sponsors/3-aba.png);">ABA Systems</a></li>
<del><li><a href="http://beefarm.ru/" rel="nofollow" style="background-image:url(../img/sponsors/3-beefarm.png);">beefarm.ru</a></li>
<del><li><a href="http://www.vzzual.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-vzzual.png);">Vzzual.com</a></li>
<del><li><a href="http://infinite-code.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-infinite_code.png);">Infinite Code</a></li>
<del><li><a href="http://crosswordtracker.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-crosswordtracker.png);">Crossword Tracker</a></li>
<del><li><a href="https://www.pkgfarm.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-pkgfarm.png);">PkgFarm</a></li>
<del><li><a href="http://life.tl/" rel="nofollow" style="background-image:url(../img/sponsors/3-life_the_game.png);">Life. The Game.</a></li>
<del><li><a href="http://blimp.io/" rel="nofollow" style="background-image:url(../img/sponsors/3-blimp.png);">Blimp</a></li>
<del><li><a href="http://pathwright.com" rel="nofollow" style="background-image:url(../img/sponsors/3-pathwright.png);">Pathwright</a></li>
<del><li><a href="http://fluxility.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-fluxility.png);">Fluxility</a></li>
<del><li><a href="http://teonite.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-teonite.png);">Teonite</a></li>
<del><li><a href="http://trackmaven.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-trackmaven.png);">TrackMaven</a></li>
<del><li><a href="http://www.phurba.net/" rel="nofollow" style="background-image:url(../img/sponsors/3-phurba.png);">Phurba</a></li>
<del><li><a href="http://www.nephila.co.uk/" rel="nofollow" style="background-image:url(../img/sponsors/3-nephila.png);">Nephila</a></li>
<del><li><a href="http://www.aditium.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-aditium.png);">Aditium</a></li>
<del><li><a href="http://www.eyesopen.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-openeye.png);">OpenEye Scientific Software</a></li>
<del><li><a href="https://holvi.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-holvi.png);">Holvi</a></li>
<del><li><a href="http://cantemo.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-cantemo.gif);">Cantemo</a></li>
<del><li><a href="https://www.makespace.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-makespace.png);">MakeSpace</a></li>
<del><li><a href="https://www.ax-semantics.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-ax_semantics.png);">AX Semantics</a></li>
<del><li><a href="http://istrategylabs.com/" rel="nofollow" style="background-image:url(../img/sponsors/3-isl.png);">ISL</a></li>
<add><li><a href="http://www.imtapps.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-imt_computer_services.png);">IMT Computer Services</a></li>
<add><li><a href="http://wildfish.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-wildfish.png);">Wildfish</a></li>
<add><li><a href="http://www.thermondo.de/" rel="nofollow" style="background-image:url(../../img/sponsors//3-thermondo-gmbh.png);">Thermondo GmbH</a></li>
<add><li><a href="http://providenz.fr/" rel="nofollow" style="background-image:url(../../img/sponsors//3-providenz.png);">Providenz</a></li>
<add><li><a href="https://www.alwaysdata.com" rel="nofollow" style="background-image:url(../../img/sponsors//3-alwaysdata.png);">alwaysdata.com</a></li>
<add><li><a href="http://www.triggeredmessaging.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-triggered_messaging.png);">Triggered Messaging</a></li>
<add><li><a href="https://www.ipushpull.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-ipushpull.png);">PushPull Technology Ltd</a></li>
<add><li><a href="http://www.transcode.de/" rel="nofollow" style="background-image:url(../../img/sponsors//3-transcode.png);">Transcode</a></li>
<add><li><a href="https://garfo.io/" rel="nofollow" style="background-image:url(../../img/sponsors//3-garfo.png);">Garfo</a></li>
<add><li><a href="https://goshippo.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-shippo.png);">Shippo</a></li>
<add><li><a href="http://www.gizmag.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-gizmag.png);">Gizmag</a></li>
<add><li><a href="http://www.tivix.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-tivix.png);">Tivix</a></li>
<add><li><a href="http://www.safaribooksonline.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-safari.png);">Safari</a></li>
<add><li><a href="http://brightloop.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-brightloop.png);">Bright Loop</a></li>
<add><li><a href="http://www.aba-systems.com.au/" rel="nofollow" style="background-image:url(../../img/sponsors//3-aba.png);">ABA Systems</a></li>
<add><li><a href="http://beefarm.ru/" rel="nofollow" style="background-image:url(../../img/sponsors//3-beefarm.png);">beefarm.ru</a></li>
<add><li><a href="http://www.vzzual.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-vzzual.png);">Vzzual.com</a></li>
<add><li><a href="http://infinite-code.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-infinite_code.png);">Infinite Code</a></li>
<add><li><a href="http://crosswordtracker.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-crosswordtracker.png);">Crossword Tracker</a></li>
<add><li><a href="https://www.pkgfarm.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-pkgfarm.png);">PkgFarm</a></li>
<add><li><a href="http://life.tl/" rel="nofollow" style="background-image:url(../../img/sponsors//3-life_the_game.png);">Life. The Game.</a></li>
<add><li><a href="http://blimp.io/" rel="nofollow" style="background-image:url(../../img/sponsors//3-blimp.png);">Blimp</a></li>
<add><li><a href="http://pathwright.com" rel="nofollow" style="background-image:url(../../img/sponsors//3-pathwright.png);">Pathwright</a></li>
<add><li><a href="http://fluxility.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-fluxility.png);">Fluxility</a></li>
<add><li><a href="http://teonite.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-teonite.png);">Teonite</a></li>
<add><li><a href="http://trackmaven.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-trackmaven.png);">TrackMaven</a></li>
<add><li><a href="http://www.phurba.net/" rel="nofollow" style="background-image:url(../../img/sponsors//3-phurba.png);">Phurba</a></li>
<add><li><a href="http://www.nephila.co.uk/" rel="nofollow" style="background-image:url(../../img/sponsors//3-nephila.png);">Nephila</a></li>
<add><li><a href="http://www.aditium.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-aditium.png);">Aditium</a></li>
<add><li><a href="http://www.eyesopen.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-openeye.png);">OpenEye Scientific Software</a></li>
<add><li><a href="https://holvi.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-holvi.png);">Holvi</a></li>
<add><li><a href="http://cantemo.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-cantemo.gif);">Cantemo</a></li>
<add><li><a href="https://www.makespace.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-makespace.png);">MakeSpace</a></li>
<add><li><a href="https://www.ax-semantics.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-ax_semantics.png);">AX Semantics</a></li>
<add><li><a href="http://istrategylabs.com/" rel="nofollow" style="background-image:url(../../img/sponsors//3-isl.png);">ISL</a></li>
<ide> </ul>
<ide>
<ide> <div style="clear: both; padding-bottom: 40px;"></div> | 1 |
Javascript | Javascript | allow wider regex in interface name | 9cb72930e51ab86668943513981af3b363b60356 | <ide><path>lib/internal/net.js
<ide> const IPv6Reg = new RegExp('^(' +
<ide> `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` +
<ide> `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` +
<ide> `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` +
<del>')(%[0-9a-zA-Z]{1,})?$');
<add>')(%[0-9a-zA-Z-.:]{1,})?$');
<ide>
<ide> function isIPv4(s) {
<ide> return IPv4Reg.test(s);
<ide><path>test/parallel/test-net-isip.js
<ide> assert.strictEqual(net.isIP('::2001:252:1:2008:6'), 6);
<ide> assert.strictEqual(net.isIP('::2001:252:1:1.1.1.1'), 6);
<ide> assert.strictEqual(net.isIP('::2001:252:1:255.255.255.255'), 6);
<ide> assert.strictEqual(net.isIP('::2001:252:1:255.255.255.255.76'), 0);
<add>assert.strictEqual(net.isIP('fe80::2008%eth0'), 6);
<add>assert.strictEqual(net.isIP('fe80::2008%eth0.0'), 6);
<add>assert.strictEqual(net.isIP('fe80::2008%eth0@1'), 0);
<ide> assert.strictEqual(net.isIP('::anything'), 0);
<ide> assert.strictEqual(net.isIP('::1'), 6);
<ide> assert.strictEqual(net.isIP('::'), 6); | 2 |
Ruby | Ruby | fix the precedence issue here | 56de4e9a8090e2e617a0d478d38c0fccfce7d725 | <ide><path>actionpack/lib/action_dispatch/testing/integration.rb
<ide> def process(method, path, parameters = nil, rack_environment = nil)
<ide> :params => parameters,
<ide>
<ide> "SERVER_NAME" => hostname,
<del> "SERVER_PORT" => port || https? ? "443" : "80",
<add> "SERVER_PORT" => port || (https? ? "443" : "80"),
<ide> "HTTPS" => https? ? "on" : "off",
<ide> "rack.url_scheme" => https? ? "https" : "http",
<ide> | 1 |
Text | Text | fix typo in changelogs | b88de12bfba91ad9e683cdac20dc3b9682689a0e | <ide><path>doc/changelogs/CHANGELOG_V12.md
<ide> This is a security release.
<ide> * **CVE-2021-22959**: HTTP Request Smuggling due to spaced in headers (Medium)
<ide> * The http parser accepts requests with a space (SP) right after the header name before the colon. This can lead to HTTP Request Smuggling (HRS). More details will be available at [CVE-2021-22959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22959) after publication.
<ide> * **CVE-2021-22960**: HTTP Request Smuggling when parsing the body (Medium)
<del> * The parse ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<add> * The http parser ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<ide>
<ide> ### Commits
<ide>
<ide><path>doc/changelogs/CHANGELOG_V14.md
<ide> This is a security release.
<ide> * **CVE-2021-22959**: HTTP Request Smuggling due to spaced in headers (Medium)
<ide> * The http parser accepts requests with a space (SP) right after the header name before the colon. This can lead to HTTP Request Smuggling (HRS). More details will be available at [CVE-2021-22959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22959) after publication.
<ide> * **CVE-2021-22960**: HTTP Request Smuggling when parsing the body (Medium)
<del> * The parse ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<add> * The http parser ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<ide>
<ide> ### Commits
<ide>
<ide><path>doc/changelogs/CHANGELOG_V16.md
<ide> This is a security release.
<ide> * **CVE-2021-22959**: HTTP Request Smuggling due to spaced in headers (Medium)
<ide> * The http parser accepts requests with a space (SP) right after the header name before the colon. This can lead to HTTP Request Smuggling (HRS). More details will be available at [CVE-2021-22959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22959) after publication.
<ide> * **CVE-2021-22960**: HTTP Request Smuggling when parsing the body (Medium)
<del> * The parse ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<add> * The http parser ignores chunk extensions when parsing the body of chunked requests. This leads to HTTP Request Smuggling (HRS) under certain conditions. More details will be available at [CVE-2021-22960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22960) after publication.
<ide>
<ide> ### Commits
<ide> | 3 |
PHP | PHP | fix cs and add int as a numericrule | 306d04cc04fa00d57cddac810b0f329af101d598 | <ide><path>src/Illuminate/Validation/Validator.php
<ide> class Validator implements ValidatorContract
<ide> *
<ide> * @var array
<ide> */
<del> protected $numericRules = ['Numeric', 'Integer'];
<add> protected $numericRules = ['Numeric', 'Integer', 'Int'];
<ide>
<ide> /**
<ide> * The validation rules that imply the field is required.
<ide> protected function requireParameterCount($count, $parameters, $rule)
<ide> /**
<ide> * Normalizes a rule so that we can accept short types.
<ide> *
<del> * @param string $rule
<del> *
<add> * @param string $rule
<ide> * @return string
<ide> */
<ide> protected function normalizeRule($rule) | 1 |
Javascript | Javascript | add transition.remove. better staged transitions | 9f9255800a8f2fdc1840c2beffa57fdd0b11ad85 | <ide><path>d3.js
<del>d3 = {version: "0.16.2"}; // semver
<add>d3 = {version: "0.17.0"}; // semver
<ide> if (!Date.now) Date.now = function() {
<ide> return +new Date();
<ide> };
<ide> function d3_descending(a, b) {
<ide> }
<ide> d3.transition = d3_root.transition;
<ide>
<del>var d3_transitionId = 0;
<add>var d3_transitionId = 0,
<add> d3_transitionInheritId = 0;
<ide>
<ide> function d3_transition(groups) {
<ide> var transition = {},
<del> transitionId = ++d3_transitionId,
<add> transitionId = d3_transitionInheritId || ++d3_transitionId,
<ide> tweens = {},
<ide> interpolators = [],
<add> remove = false,
<ide> event = d3.dispatch("start", "end"),
<ide> stage = [],
<ide> delay = [],
<ide> function d3_transition(groups) {
<ide> } else {
<ide> stage[k] = 2;
<ide> if (tx.active == transitionId) {
<add> var owner = tx.owner;
<ide> for (tk in tweens) ik[tk].call(this, 1);
<del> if (tx.owner == transitionId) {
<add> if (owner == transitionId) {
<ide> delete this.__transition__;
<del> event.end.dispatch.apply(this, arguments);
<add> if (remove) this.parentNode.removeChild(this);
<ide> }
<add> d3_transitionInheritId = transitionId;
<add> event.end.dispatch.apply(this, arguments);
<add> d3_transitionInheritId = 0;
<add> tx.owner = owner;
<ide> }
<ide> }
<ide> });
<ide> function d3_transition(groups) {
<ide> return t;
<ide> };
<ide>
<add> transition.remove = function() {
<add> remove = true;
<add> return transition;
<add> };
<add>
<ide> transition.each = function(type, listener) {
<ide> event[type].add(listener);
<ide> return transition;
<ide><path>d3.min.js
<del>(function(){var o=null;d3={version:"0.16.2"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function d(){}d.prototype=a;return new d};function w(a){return Array.prototype.slice.call(a)}function B(a,d){d=w(arguments);d[0]=this;a.apply(this,d);return this}d3.range=function(a,d,e){if(arguments.length==1){d=a;a=0}if(e==o)e=1;if((d-a)/e==Infinity)throw Error("infinite range");var f=[],c=-1,b;if(e<0)for(;(b=a+e*++c)>d;)f.push(b);else for(;(b=a+e*++c)<d;)f.push(b);return f};
<add>(function(){var o=null;d3={version:"0.17.0"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function d(){}d.prototype=a;return new d};function w(a){return Array.prototype.slice.call(a)}function C(a,d){d=w(arguments);d[0]=this;a.apply(this,d);return this}d3.range=function(a,d,e){if(arguments.length==1){d=a;a=0}if(e==o)e=1;if((d-a)/e==Infinity)throw Error("infinite range");var f=[],c=-1,b;if(e<0)for(;(b=a+e*++c)>d;)f.push(b);else for(;(b=a+e*++c)<d;)f.push(b);return f};
<ide> d3.text=function(a,d,e){var f=new XMLHttpRequest;if(arguments.length==3)f.overrideMimeType(d);else e=d;f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)e(f.status<300&&f.responseText?f.responseText:o)};f.send(o)};d3.json=function(a,d){return d3.text(a,"application/json",function(e){d(e&&JSON.parse(e))})};
<del>d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var d=a.indexOf(":");return d<0?a:{space:d3.ns.prefix[a.substring(0,d)],local:a.substring(d+1)}}};d3.dispatch=function(){for(var a={},d,e=0,f=arguments.length;e<f;e++){d=arguments[e];a[d]=D(d)}return a};
<del>function D(){var a={},d=[];a.add=function(e){for(var f=0;f<d.length;f++)if(d[f].h==e)return a;d.push({h:e,on:true});return a};a.remove=function(e){for(var f=0;f<d.length;f++){var c=d[f];if(c.h==e){c.on=false;d=d.slice(0,f).concat(d.slice(f+1));break}}return a};a.dispatch=function(){for(var e=d,f=0,c=e.length;f<c;f++){var b=e[f];b.on&&b.h.apply(this,arguments)}};return a}
<del>d3.format=function(a){a=E.exec(a);var d=a[1]||" ",e=a[5],f=+a[6],c=a[7],b=a[8],h=a[9];if(b)b=b.substring(1);if(e)d="0";if(h=="d")b="0";return function(g){if(h=="d"&&g%1)return"";if(b)g=(+g).toFixed(b);else g+="";if(c){for(var i=g.lastIndexOf("."),j=i>=0?g.substring(i):(i=g.length,""),n=[];i>0;)n.push(g.substring(i-=3,i+3));g=n.reverse().join(",")+j}i=g.length;if(i<f)g=Array(f-i+1).join(d)+g;return g}};
<del>var E=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,H=G(2),I=G(3),fa={linear:function(){return J},poly:G,quad:function(){return H},cubic:function(){return I},sin:function(){return K},exp:function(){return aa},circle:function(){return ba},elastic:ca,back:da,bounce:function(){return ea}},ga={"in":function(a){return a},out:L,"in-out":M,"out-in":function(a){return M(L(a))}};
<del>d3.ease=function(a){var d=a.indexOf("-");return ga[d>=0?a.substring(d+1):"in"](fa[d>=0?a.substring(0,d):a].apply(o,Array.prototype.slice.call(arguments,1)))};function L(a){return function(d){return 1-a(1-d)}}function M(a){return function(d){return 0.5*(d<0.5?a(2*d):2-a(2-2*d))}}function J(a){return a}function G(a){return function(d){return Math.pow(d,a)}}function K(a){return 1-Math.cos(a*Math.PI/2)}function aa(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function ba(a){return 1-Math.sqrt(1-a*a)}
<del>function ca(a,d){var e;if(arguments.length<2)d=0.45;if(arguments.length<1){a=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-e)*2*Math.PI/d)}}function da(a){a||(a=1.70158);return function(d){return d*d*((a+1)*d-a)}}function ea(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}d3.event=o;
<del>d3.interpolate=function(a,d){if(typeof d=="number")return d3.interpolateNumber(+a,d);if(typeof d=="string")return d in N||/^(#|rgb\(|hsl\()/.test(d)?d3.interpolateRgb(String(a),d):d3.interpolateString(String(a),d);if(d instanceof Array)return d3.interpolateArray(a,d);return d3.interpolateObject(a,d)};d3.interpolateNumber=function(a,d){d-=a;return function(e){return a+d*e}};
<del>d3.interpolateString=function(a,d){var e,f,c=0,b=[],h=[],g,i;for(f=0;e=O.exec(d);++f){e.index&&b.push(d.substring(c,e.index));h.push({a:b.length,x:e[0]});b.push(o);c=O.lastIndex}c<d.length&&b.push(d.substring(c));f=0;for(g=h.length;(e=O.exec(a))&&f<g;++f){i=h[f];if(i.x==e[0]){if(i.a)if(b[i.a+1]==o){b[i.a-1]+=i.x;b.splice(i.a,1);for(e=f+1;e<g;++e)h[e].a--}else{b[i.a-1]+=i.x+b[i.a+1];b.splice(i.a,2);for(e=f+1;e<g;++e)h[e].a-=2}else if(b[i.a+1]==o)b[i.a]=i.x;else{b[i.a]=i.x+b[i.a+1];b.splice(i.a+1,1);
<add>d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var d=a.indexOf(":");return d<0?a:{space:d3.ns.prefix[a.substring(0,d)],local:a.substring(d+1)}}};d3.dispatch=function(){for(var a={},d,e=0,f=arguments.length;e<f;e++){d=arguments[e];a[d]=E(d)}return a};
<add>function E(){var a={},d=[];a.add=function(e){for(var f=0;f<d.length;f++)if(d[f].h==e)return a;d.push({h:e,on:true});return a};a.remove=function(e){for(var f=0;f<d.length;f++){var c=d[f];if(c.h==e){c.on=false;d=d.slice(0,f).concat(d.slice(f+1));break}}return a};a.dispatch=function(){for(var e=d,f=0,c=e.length;f<c;f++){var b=e[f];b.on&&b.h.apply(this,arguments)}};return a}
<add>d3.format=function(a){a=F.exec(a);var d=a[1]||" ",e=a[5],f=+a[6],c=a[7],b=a[8],h=a[9];if(b)b=b.substring(1);if(e)d="0";if(h=="d")b="0";return function(g){if(h=="d"&&g%1)return"";if(b)g=(+g).toFixed(b);else g+="";if(c){for(var i=g.lastIndexOf("."),j=i>=0?g.substring(i):(i=g.length,""),m=[];i>0;)m.push(g.substring(i-=3,i+3));g=m.reverse().join(",")+j}i=g.length;if(i<f)g=Array(f-i+1).join(d)+g;return g}};
<add>var F=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,H=G(2),I=G(3),ga={linear:function(){return J},poly:G,quad:function(){return H},cubic:function(){return I},sin:function(){return aa},exp:function(){return ba},circle:function(){return ca},elastic:da,back:ea,bounce:function(){return fa}},ha={"in":function(a){return a},out:K,"in-out":L,"out-in":function(a){return L(K(a))}};
<add>d3.ease=function(a){var d=a.indexOf("-");return ha[d>=0?a.substring(d+1):"in"](ga[d>=0?a.substring(0,d):a].apply(o,Array.prototype.slice.call(arguments,1)))};function K(a){return function(d){return 1-a(1-d)}}function L(a){return function(d){return 0.5*(d<0.5?a(2*d):2-a(2-2*d))}}function J(a){return a}function G(a){return function(d){return Math.pow(d,a)}}function aa(a){return 1-Math.cos(a*Math.PI/2)}function ba(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function ca(a){return 1-Math.sqrt(1-a*a)}
<add>function da(a,d){var e;if(arguments.length<2)d=0.45;if(arguments.length<1){a=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-e)*2*Math.PI/d)}}function ea(a){a||(a=1.70158);return function(d){return d*d*((a+1)*d-a)}}function fa(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}d3.event=o;
<add>d3.interpolate=function(a,d){if(typeof d=="number")return d3.interpolateNumber(+a,d);if(typeof d=="string")return d in M||/^(#|rgb\(|hsl\()/.test(d)?d3.interpolateRgb(String(a),d):d3.interpolateString(String(a),d);if(d instanceof Array)return d3.interpolateArray(a,d);return d3.interpolateObject(a,d)};d3.interpolateNumber=function(a,d){d-=a;return function(e){return a+d*e}};
<add>d3.interpolateString=function(a,d){var e,f,c=0,b=[],h=[],g,i;for(f=0;e=N.exec(d);++f){e.index&&b.push(d.substring(c,e.index));h.push({a:b.length,x:e[0]});b.push(o);c=N.lastIndex}c<d.length&&b.push(d.substring(c));f=0;for(g=h.length;(e=N.exec(a))&&f<g;++f){i=h[f];if(i.x==e[0]){if(i.a)if(b[i.a+1]==o){b[i.a-1]+=i.x;b.splice(i.a,1);for(e=f+1;e<g;++e)h[e].a--}else{b[i.a-1]+=i.x+b[i.a+1];b.splice(i.a,2);for(e=f+1;e<g;++e)h[e].a-=2}else if(b[i.a+1]==o)b[i.a]=i.x;else{b[i.a]=i.x+b[i.a+1];b.splice(i.a+1,1);
<ide> for(e=f+1;e<g;++e)h[e].a--}h.splice(f,1);g--;f--}else i.x=d3.interpolateNumber(parseFloat(e[0]),parseFloat(i.x))}for(;f<g;){i=h.pop();if(b[i.a+1]==o)b[i.a]=i.x;else{b[i.a]=i.x+b[i.a+1];b.splice(i.a+1,1)}g--}if(b.length==1)return b[0]==o?h[0].x:function(){return d};return function(j){for(f=0;f<g;++f)b[(i=h[f]).a]=i.x(j);return b.join("")}};
<del>d3.interpolateRgb=function(a,d){a=P(a);d=P(d);var e=a.d,f=a.c,c=a.b,b=d.d-e,h=d.c-f,g=d.b-c;return function(i){return"rgb("+Math.round(e+b*i)+","+Math.round(f+h*i)+","+Math.round(c+g*i)+")"}};d3.interpolateArray=function(a,d){var e=[],f=[],c=a.length,b=d.length,h=Math.min(a.length,d.length),g;for(g=0;g<h;++g)e.push(d3.interpolate(a[g],d[g]));for(;g<c;++g)f[g]=a[g];for(;g<b;++g)f[g]=d[g];return function(i){for(g=0;g<h;++g)f[g]=e[g](i);return f}};
<del>d3.interpolateObject=function(a,d){var e={},f={},c;for(c in a)if(c in d)e[c]=(c in ha||/\bcolor\b/.test(c)?d3.interpolateRgb:d3.interpolate)(a[c],d[c]);else f[c]=a[c];for(c in d)c in a||(f[c]=d[c]);return function(b){for(c in e)f[c]=e[c](b);return f}};var O=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,ha={background:1,fill:1,stroke:1};
<del>function P(a){var d,e,f,c,b;if(c=/([a-z]+)\((.*)\)/i.exec(a)){b=c[2].split(",");switch(c[1]){case "hsl":return Q(parseFloat(b[0]),parseFloat(b[1])/100,parseFloat(b[2])/100);case "rgb":return{d:R(b[0]),c:R(b[1]),b:R(b[2])}}}if(c=N[a])return c;if(a==o)return N.n;if(a.charAt(0)=="#"){if(a.length==4){d=a.charAt(1);d+=d;e=a.charAt(2);e+=e;f=a.charAt(3);f+=f}else if(a.length==7){d=a.substring(1,3);e=a.substring(3,5);f=a.substring(5,7)}d=parseInt(d,16);e=parseInt(e,16);f=parseInt(f,16)}return{d:d,c:e,b:f}}
<del>function Q(a,d,e){function f(h){if(h>360)h-=360;else if(h<0)h+=360;if(h<60)return c+(b-c)*h/60;if(h<180)return b;if(h<240)return c+(b-c)*(240-h)/60;return c}var c,b;a%=360;if(a<0)a+=360;d=d<0?0:d>1?1:d;e=e<0?0:e>1?1:e;b=e<=0.5?e*(1+d):e+d-e*d;c=2*e-b;return{d:Math.round(f(a+120)*255),c:Math.round(f(a)*255),b:Math.round(f(a-120)*255)}}function R(a){var d=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(d*2.55):d}
<del>var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",
<add>d3.interpolateRgb=function(a,d){a=O(a);d=O(d);var e=a.d,f=a.c,c=a.b,b=d.d-e,h=d.c-f,g=d.b-c;return function(i){return"rgb("+Math.round(e+b*i)+","+Math.round(f+h*i)+","+Math.round(c+g*i)+")"}};d3.interpolateArray=function(a,d){var e=[],f=[],c=a.length,b=d.length,h=Math.min(a.length,d.length),g;for(g=0;g<h;++g)e.push(d3.interpolate(a[g],d[g]));for(;g<c;++g)f[g]=a[g];for(;g<b;++g)f[g]=d[g];return function(i){for(g=0;g<h;++g)f[g]=e[g](i);return f}};
<add>d3.interpolateObject=function(a,d){var e={},f={},c;for(c in a)if(c in d)e[c]=(c in ia||/\bcolor\b/.test(c)?d3.interpolateRgb:d3.interpolate)(a[c],d[c]);else f[c]=a[c];for(c in d)c in a||(f[c]=d[c]);return function(b){for(c in e)f[c]=e[c](b);return f}};var N=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,ia={background:1,fill:1,stroke:1};
<add>function O(a){var d,e,f,c,b;if(c=/([a-z]+)\((.*)\)/i.exec(a)){b=c[2].split(",");switch(c[1]){case "hsl":return P(parseFloat(b[0]),parseFloat(b[1])/100,parseFloat(b[2])/100);case "rgb":return{d:Q(b[0]),c:Q(b[1]),b:Q(b[2])}}}if(c=M[a])return c;if(a==o)return M.n;if(a.charAt(0)=="#"){if(a.length==4){d=a.charAt(1);d+=d;e=a.charAt(2);e+=e;f=a.charAt(3);f+=f}else if(a.length==7){d=a.substring(1,3);e=a.substring(3,5);f=a.substring(5,7)}d=parseInt(d,16);e=parseInt(e,16);f=parseInt(f,16)}return{d:d,c:e,b:f}}
<add>function P(a,d,e){function f(h){if(h>360)h-=360;else if(h<0)h+=360;if(h<60)return c+(b-c)*h/60;if(h<180)return b;if(h<240)return c+(b-c)*(240-h)/60;return c}var c,b;a%=360;if(a<0)a+=360;d=d<0?0:d>1?1:d;e=e<0?0:e>1?1:e;b=e<=0.5?e*(1+d):e+d-e*d;c=2*e-b;return{d:Math.round(f(a+120)*255),c:Math.round(f(a)*255),b:Math.round(f(a-120)*255)}}function Q(a){var d=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(d*2.55):d}
<add>var M={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",
<ide> darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",
<ide> ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",
<ide> lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",
<ide> moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",
<del>seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},S;for(S in N)N[S]=P(N[S]);d3.hsl=function(a,d,e){a=Q(a,d,e);return"rgb("+a.d+","+a.c+","+a.b+")"};var U=T([[document]]);
<del>U[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?U.select(a):T([[a]])};d3.selectAll=function(a){return typeof a=="string"?U.selectAll(a):T([w(a)])};
<del>function T(a){function d(c){for(var b=[],h,g,i,j,n=0,p=a.length;n<p;n++){i=a[n];b.push(h=[]);h.parentNode=i.parentNode;h.parentData=i.parentData;for(var k=0,l=i.length;k<l;k++)if(j=i[k]){h.push(g=c(j));if(g&&"__data__"in j)g.__data__=j.__data__}else h.push(o)}return T(b)}function e(c){for(var b=[],h,g,i,j=0,n=a.length;j<n;j++){g=a[j];for(var p=0,k=g.length;p<k;p++)if(i=g[p]){b.push(h=c(i));h.parentNode=i;h.parentData=i.__data__}}return T(b)}function f(c){for(var b=0,h=a.length;b<h;b++)for(var g=a[b],
<del>i=0,j=g.length;i<j;i++){var n=g[i];if(n)return c.call(n,n.__data__,i)}return o}a.select=function(c){return d(function(b){return b.querySelector(c)})};a.selectAll=function(c){return e(function(b){return w(b.querySelectorAll(c))})};a.filter=function(c){for(var b=[],h,g,i,j=0,n=a.length;j<n;j++){g=a[j];b.push(h=[]);h.parentNode=g.parentNode;h.parentData=g.parentData;for(var p=0,k=g.length;p<k;p++)if((i=g[p])&&c.call(i,i.__data__,p))h.push(i)}return T(b)};a.data=function(c,b){function h(l,q){function r(ia){return l.parentNode.appendChild(ia)}
<del>var m=0,s=l.length,t=q.length,u=Math.min(s,t),F=Math.max(s,t),x=[],y=[],v=[],z,A;if(b){u={};F=[];var C;A=q.length;for(m=0;m<s;m++){C=b.nodeKey(z=l[m]);if(C in u)v[A++]=l[m];else{u[C]=z;F.push(C)}}for(m=0;m<t;m++){if(z=u[C=b.dataKey(A=q[m])]){z.__data__=A;x[m]=z;y[m]=v[m]=o}else{y[m]={appendChild:r,__data__:A};x[m]=v[m]=o}delete u[C]}for(m=0;m<s;m++)if(F[m]in u)v[m]=l[m]}else{for(;m<u;m++){z=l[m];A=q[m];if(z){z.__data__=A;x[m]=z;y[m]=v[m]=o}else{y[m]={appendChild:r,__data__:A};x[m]=v[m]=o}}for(;m<
<del>t;m++){y[m]={appendChild:r,__data__:q[m]};x[m]=v[m]=o}for(;m<F;m++){v[m]=l[m];y[m]=x[m]=o}}y.parentNode=x.parentNode=v.parentNode=l.parentNode;y.parentData=x.parentData=v.parentData=l.parentData;n.push(y);p.push(x);k.push(v)}var g=-1,i=a.length,j,n=[],p=[],k=[];if(typeof b=="string")b=ja(b);if(typeof c=="function")for(;++g<i;)h(j=a[g],c.call(j,j.parentData,g));else for(;++g<i;)h(j=a[g],c);g=T(p);g.enter=function(l){return T(n).append(l)};g.exit=function(){return T(k)};return g};a.each=function(c){for(var b=
<del>0,h=a.length;b<h;b++)for(var g=a[b],i=0,j=g.length;i<j;i++){var n=g[i];n&&c.call(n,n.__data__,i)}return a};a.attr=function(c,b){function h(){this.removeAttribute(c)}function g(){this.removeAttributeNS(c.space,c.local)}function i(){this.setAttribute(c,b)}function j(){this.setAttributeNS(c.space,c.local,b)}function n(){var k=b.apply(this,arguments);k==o?this.removeAttribute(c):this.setAttribute(c,k)}function p(){var k=b.apply(this,arguments);k==o?this.removeAttributeNS(c.space,c.local):this.setAttributeNS(c.space,
<del>c.local,k)}c=d3.ns.qualify(c);if(arguments.length<2)return f(c.local?function(){return this.getAttributeNS(c.space,c.local)}:function(){return this.getAttribute(c)});return a.each(b==o?c.local?g:h:typeof b=="function"?c.local?p:n:c.local?j:i)};a.style=function(c,b,h){function g(){this.style.removeProperty(c)}function i(){this.style.setProperty(c,b,h)}function j(){var n=b.apply(this,arguments);n==o?this.style.removeProperty(c):this.style.setProperty(c,n,h)}if(arguments.length<3)h=o;if(arguments.length<
<add>seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},R;for(R in M)M[R]=O(M[R]);d3.hsl=function(a,d,e){a=P(a,d,e);return"rgb("+a.d+","+a.c+","+a.b+")"};var T=S([[document]]);
<add>T[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?T.select(a):S([[a]])};d3.selectAll=function(a){return typeof a=="string"?T.selectAll(a):S([w(a)])};
<add>function S(a){function d(c){for(var b=[],h,g,i,j,m=0,p=a.length;m<p;m++){i=a[m];b.push(h=[]);h.parentNode=i.parentNode;h.parentData=i.parentData;for(var r=0,k=i.length;r<k;r++)if(j=i[r]){h.push(g=c(j));if(g&&"__data__"in j)g.__data__=j.__data__}else h.push(o)}return S(b)}function e(c){for(var b=[],h,g,i,j=0,m=a.length;j<m;j++){g=a[j];for(var p=0,r=g.length;p<r;p++)if(i=g[p]){b.push(h=c(i));h.parentNode=i;h.parentData=i.__data__}}return S(b)}function f(c){for(var b=0,h=a.length;b<h;b++)for(var g=a[b],
<add>i=0,j=g.length;i<j;i++){var m=g[i];if(m)return c.call(m,m.__data__,i)}return o}a.select=function(c){return d(function(b){return b.querySelector(c)})};a.selectAll=function(c){return e(function(b){return w(b.querySelectorAll(c))})};a.filter=function(c){for(var b=[],h,g,i,j=0,m=a.length;j<m;j++){g=a[j];b.push(h=[]);h.parentNode=g.parentNode;h.parentData=g.parentData;for(var p=0,r=g.length;p<r;p++)if((i=g[p])&&c.call(i,i.__data__,p))h.push(i)}return S(b)};a.data=function(c,b){function h(k,n){function q(ja){return k.parentNode.appendChild(ja)}
<add>var l=0,s=k.length,t=n.length,u=Math.min(s,t),A=Math.max(s,t),x=[],y=[],v=[],z,B;if(b){u={};A=[];var D;B=n.length;for(l=0;l<s;l++){D=b.nodeKey(z=k[l]);if(D in u)v[B++]=k[l];else{u[D]=z;A.push(D)}}for(l=0;l<t;l++){if(z=u[D=b.dataKey(B=n[l])]){z.__data__=B;x[l]=z;y[l]=v[l]=o}else{y[l]={appendChild:q,__data__:B};x[l]=v[l]=o}delete u[D]}for(l=0;l<s;l++)if(A[l]in u)v[l]=k[l]}else{for(;l<u;l++){z=k[l];B=n[l];if(z){z.__data__=B;x[l]=z;y[l]=v[l]=o}else{y[l]={appendChild:q,__data__:B};x[l]=v[l]=o}}for(;l<
<add>t;l++){y[l]={appendChild:q,__data__:n[l]};x[l]=v[l]=o}for(;l<A;l++){v[l]=k[l];y[l]=x[l]=o}}y.parentNode=x.parentNode=v.parentNode=k.parentNode;y.parentData=x.parentData=v.parentData=k.parentData;m.push(y);p.push(x);r.push(v)}var g=-1,i=a.length,j,m=[],p=[],r=[];if(typeof b=="string")b=ka(b);if(typeof c=="function")for(;++g<i;)h(j=a[g],c.call(j,j.parentData,g));else for(;++g<i;)h(j=a[g],c);g=S(p);g.enter=function(k){return S(m).append(k)};g.exit=function(){return S(r)};return g};a.each=function(c){for(var b=
<add>0,h=a.length;b<h;b++)for(var g=a[b],i=0,j=g.length;i<j;i++){var m=g[i];m&&c.call(m,m.__data__,i)}return a};a.attr=function(c,b){function h(){this.removeAttribute(c)}function g(){this.removeAttributeNS(c.space,c.local)}function i(){this.setAttribute(c,b)}function j(){this.setAttributeNS(c.space,c.local,b)}function m(){var r=b.apply(this,arguments);r==o?this.removeAttribute(c):this.setAttribute(c,r)}function p(){var r=b.apply(this,arguments);r==o?this.removeAttributeNS(c.space,c.local):this.setAttributeNS(c.space,
<add>c.local,r)}c=d3.ns.qualify(c);if(arguments.length<2)return f(c.local?function(){return this.getAttributeNS(c.space,c.local)}:function(){return this.getAttribute(c)});return a.each(b==o?c.local?g:h:typeof b=="function"?c.local?p:m:c.local?j:i)};a.style=function(c,b,h){function g(){this.style.removeProperty(c)}function i(){this.style.setProperty(c,b,h)}function j(){var m=b.apply(this,arguments);m==o?this.style.removeProperty(c):this.style.setProperty(c,m,h)}if(arguments.length<3)h=o;if(arguments.length<
<ide> 2)return f(function(){return window.getComputedStyle(this,o).getPropertyValue(c)});return a.each(b==o?g:typeof b=="function"?j:i)};a.property=function(c,b){function h(){delete this[c]}function g(){this[c]=b}function i(){var j=b.apply(this,arguments);if(j==o)delete this[c];else this[c]=j}c=d3.ns.qualify(c);if(arguments.length<2)return f(function(){return this[c]});return a.each(b==o?h:typeof b=="function"?i:g)};a.text=function(c){function b(){this.appendChild(document.createTextNode(c))}function h(){var g=
<ide> c.apply(this,arguments);g!=o&&this.appendChild(document.createTextNode(g))}if(arguments.length<1)return f(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});return c==o?a:a.each(typeof c=="function"?h:b)};a.html=function(c){function b(){this.innerHTML=c}function h(){this.innerHTML=c.apply(this,arguments)}if(arguments.length<1)return f(function(){return this.innerHTML});return a.each(typeof c=="function"?h:b)};a.append=function(c){function b(g){return g.appendChild(document.createElement(c))}
<del>function h(g){return g.appendChild(document.createElementNS(c.space,c.local))}c=d3.ns.qualify(c);return d(c.local?h:b)};a.remove=function(){return d(function(c){var b=c.parentNode;b.removeChild(c);return b})};a.sort=function(c){c=ka.apply(this,arguments);for(var b=0,h=a.length;b<h;b++){var g=a[b];g.sort(c);for(var i=1,j=g.length,n=g[0];i<j;i++){var p=g[i];if(p){n&&n.parentNode.insertBefore(p,n.nextSibling);n=p}}}return a};a.on=function(c,b){c="on"+c;return a.each(function(h,g){this[c]=function(i){d3.event=
<del>i;try{b.call(this,h,g)}finally{d3.event=o}}})};a.transition=function(){return V(a)};a.call=B;return a}function ja(a){return{nodeKey:function(d){return d.getAttribute(a)},dataKey:function(d){return d[a]}}}function ka(a){arguments.length||(a=la);return function(d,e){return a(d&&d.__data__,e&&e.__data__)}}function la(a,d){return a<d?-1:a>d?1:0}d3.transition=U.transition;var ma=0;
<del>function V(a){function d(k){var l=true,q=-1;a.each(function(){if(g[++q]!=2){var r=(k-i[q])/j[q],m=this.__transition__,s,t=b[q];if(r<1){l=false;if(!(r<0)){if(g[q]){if(m.g!=f){g[q]=2;return}}else if(!m||m.g>f){g[q]=2;return}else{g[q]=1;h.start.dispatch.apply(this,arguments);t=b[q]={};m.g=f;for(s in c)t[s]=c[s].apply(this,arguments)}r=p(r);for(s in c)t[s].call(this,r)}}else{g[q]=2;if(m.g==f){for(s in c)t[s].call(this,1);if(m.m==f){delete this.__transition__;h.end.dispatch.apply(this,arguments)}}}}});
<del>return l}var e={},f=++ma,c={},b=[],h=d3.dispatch("start","end"),g=[],i=[],j=[],n,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).m=f});e.delay=function(k){var l=Infinity,q=-1;if(typeof k=="function")a.each(function(){var r=i[++q]=+k.apply(this,arguments);if(r<l)l=r});else{l=+k;a.each(function(){i[++q]=l})}na(d,l);return e};e.duration=function(k){var l=-1;if(typeof k=="function"){n=0;a.each(function(){var q=j[++l]=+k.apply(this,arguments);if(q>n)n=q})}else{n=
<del>+k;a.each(function(){j[++l]=n})}return e};e.ease=function(k){p=typeof k=="string"?d3.ease(k):k;return e};e.attrTween=function(k,l){function q(m,s){var t=l.call(this,m,s,this.getAttribute(k));return function(u){this.setAttribute(k,t(u))}}function r(m,s){var t=l.call(this,m,s,this.getAttributeNS(k.space,k.local));return function(u){this.setAttributeNS(k.space,k.local,t(u))}}c["attr."+k]=k.local?r:q;return e};e.attr=function(k,l){return e.attrTween(k,W(l))};e.styleTween=function(k,l,q){c["style."+k]=
<del>function(r,m){var s=l.call(this,r,m,window.getComputedStyle(this,o).getPropertyValue(k));return function(t){this.style.setProperty(k,s(t),q)}};return e};e.style=function(k,l,q){return e.styleTween(k,W(l),q)};e.select=function(k){var l;k=V(a.select(k)).ease(p);l=-1;k.delay(function(){return i[++l]});l=-1;k.duration(function(){return j[++l]});return k};e.selectAll=function(k){var l;k=V(a.selectAll(k)).ease(p);l=-1;k.delay(function(q,r){return i[r?l:++l]});l=-1;k.duration(function(q,r){return j[r?l:
<del>++l]});return k};e.each=function(k,l){h[k].add(l);return e};e.call=B;return e.delay(0).duration(250)}var X=o,Y=0,Z;function na(a,d){var e=Date.now(),f=false,c=e+d,b=X;if(isFinite(d)){for(;b;){if(b.j==a){b.i=e;b.delay=d;f=true}else{var h=b.i+b.delay;if(h<c)c=h}b=b.next}f||(X={j:a,i:e,delay:d,next:X});if(!Z){clearTimeout(Y);Y=setTimeout(oa,Math.max(24,c-e))}}}function oa(){Z=setInterval(pa,24);Y=0}
<del>function pa(){for(var a,d=Date.now(),e=X;e;){a=d-e.i;if(a>e.delay)e.l=e.j(a);e=e.next}a=o;for(d=X;d;)d=d.l?a?a.next=d.next:X=d.next:(a=d).next;a||(Z=clearInterval(Z))}function W(a){return typeof a=="function"?function(d,e,f){return d3.interpolate(f,a.call(this,d,e))}:function(d,e,f){return d3.interpolate(f,a)}}d3.scale={};
<del>d3.scale.linear=function(){function a(j){return i((j-e)*h)}function d(j){var n=Math.min(e,f),p=Math.max(e,f),k=p-n,l=Math.pow(10,Math.floor(Math.log(k/j)/Math.LN10));j=j/(k/l);if(j<=0.15)l*=10;else if(j<=0.35)l*=5;else if(j<=0.75)l*=2;return{start:Math.ceil(n/l)*l,stop:Math.floor(p/l)*l+l*0.5,k:l}}var e=0,f=1,c=0,b=1,h=1/(f-e),g=(f-e)/(b-c),i=d3.interpolate(c,b);a.invert=function(j){return(j-c)*g+e};a.domain=function(j){if(!arguments.length)return[e,f];e=j[0];f=j[1];h=1/(f-e);g=(f-e)/(b-c);return a};
<del>a.range=function(j){if(!arguments.length)return[c,b];c=j[0];b=j[1];g=(f-e)/(b-c);i=d3.interpolate(c,b);return a};a.ticks=function(j){j=d(j);return d3.range(j.start,j.stop,j.k)};a.tickFormat=function(j){return d3.format(",."+Math.max(0,-Math.floor(Math.log(d(j).k)/Math.LN10+0.01))+"f")};return a};
<add>function h(g){return g.appendChild(document.createElementNS(c.space,c.local))}c=d3.ns.qualify(c);return d(c.local?h:b)};a.remove=function(){return d(function(c){var b=c.parentNode;b.removeChild(c);return b})};a.sort=function(c){c=la.apply(this,arguments);for(var b=0,h=a.length;b<h;b++){var g=a[b];g.sort(c);for(var i=1,j=g.length,m=g[0];i<j;i++){var p=g[i];if(p){m&&m.parentNode.insertBefore(p,m.nextSibling);m=p}}}return a};a.on=function(c,b){c="on"+c;return a.each(function(h,g){this[c]=function(i){d3.event=
<add>i;try{b.call(this,h,g)}finally{d3.event=o}}})};a.transition=function(){return U(a)};a.call=C;return a}function ka(a){return{nodeKey:function(d){return d.getAttribute(a)},dataKey:function(d){return d[a]}}}function la(a){arguments.length||(a=ma);return function(d,e){return a(d&&d.__data__,e&&e.__data__)}}function ma(a,d){return a<d?-1:a>d?1:0}d3.transition=T.transition;var na=0,V=0;
<add>function U(a){function d(k){var n=true,q=-1;a.each(function(){if(i[++q]!=2){var l=(k-j[q])/m[q],s=this.__transition__,t,u=b[q];if(l<1){n=false;if(!(l<0)){if(i[q]){if(s.g!=f){i[q]=2;return}}else if(!s||s.g>f){i[q]=2;return}else{i[q]=1;g.start.dispatch.apply(this,arguments);u=b[q]={};s.g=f;for(t in c)u[t]=c[t].apply(this,arguments)}s=r(l);for(t in c)u[t].call(this,s)}}else{i[q]=2;if(s.g==f){l=s.k;for(t in c)u[t].call(this,1);if(l==f){delete this.__transition__;h&&this.parentNode.removeChild(this)}V=
<add>f;g.end.dispatch.apply(this,arguments);V=0;s.k=l}}}});return n}var e={},f=V||++na,c={},b=[],h=false,g=d3.dispatch("start","end"),i=[],j=[],m=[],p,r=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).k=f});e.delay=function(k){var n=Infinity,q=-1;if(typeof k=="function")a.each(function(){var l=j[++q]=+k.apply(this,arguments);if(l<n)n=l});else{n=+k;a.each(function(){j[++q]=n})}oa(d,n);return e};e.duration=function(k){var n=-1;if(typeof k=="function"){p=0;a.each(function(){var q=
<add>m[++n]=+k.apply(this,arguments);if(q>p)p=q})}else{p=+k;a.each(function(){m[++n]=p})}return e};e.ease=function(k){r=typeof k=="string"?d3.ease(k):k;return e};e.attrTween=function(k,n){function q(s,t){var u=n.call(this,s,t,this.getAttribute(k));return function(A){this.setAttribute(k,u(A))}}function l(s,t){var u=n.call(this,s,t,this.getAttributeNS(k.space,k.local));return function(A){this.setAttributeNS(k.space,k.local,u(A))}}c["attr."+k]=k.local?l:q;return e};e.attr=function(k,n){return e.attrTween(k,
<add>W(n))};e.styleTween=function(k,n,q){c["style."+k]=function(l,s){var t=n.call(this,l,s,window.getComputedStyle(this,o).getPropertyValue(k));return function(u){this.style.setProperty(k,t(u),q)}};return e};e.style=function(k,n,q){return e.styleTween(k,W(n),q)};e.select=function(k){var n;k=U(a.select(k)).ease(r);n=-1;k.delay(function(){return j[++n]});n=-1;k.duration(function(){return m[++n]});return k};e.selectAll=function(k){var n;k=U(a.selectAll(k)).ease(r);n=-1;k.delay(function(q,l){return j[l?n:
<add>++n]});n=-1;k.duration(function(q,l){return m[l?n:++n]});return k};e.remove=function(){h=true;return e};e.each=function(k,n){g[k].add(n);return e};e.call=C;return e.delay(0).duration(250)}var X=o,Y=0,Z;function oa(a,d){var e=Date.now(),f=false,c=e+d,b=X;if(isFinite(d)){for(;b;){if(b.j==a){b.i=e;b.delay=d;f=true}else{var h=b.i+b.delay;if(h<c)c=h}b=b.next}f||(X={j:a,i:e,delay:d,next:X});if(!Z){clearTimeout(Y);Y=setTimeout(pa,Math.max(24,c-e))}}}function pa(){Z=setInterval(qa,24);Y=0}
<add>function qa(){for(var a,d=Date.now(),e=X;e;){a=d-e.i;if(a>e.delay)e.m=e.j(a);e=e.next}a=o;for(d=X;d;)d=d.m?a?a.next=d.next:X=d.next:(a=d).next;a||(Z=clearInterval(Z))}function W(a){return typeof a=="function"?function(d,e,f){return d3.interpolate(f,a.call(this,d,e))}:function(d,e,f){return d3.interpolate(f,a)}}d3.scale={};
<add>d3.scale.linear=function(){function a(j){return i((j-e)*h)}function d(j){var m=Math.min(e,f),p=Math.max(e,f),r=p-m,k=Math.pow(10,Math.floor(Math.log(r/j)/Math.LN10));j=j/(r/k);if(j<=0.15)k*=10;else if(j<=0.35)k*=5;else if(j<=0.75)k*=2;return{start:Math.ceil(m/k)*k,stop:Math.floor(p/k)*k+k*0.5,l:k}}var e=0,f=1,c=0,b=1,h=1/(f-e),g=(f-e)/(b-c),i=d3.interpolate(c,b);a.invert=function(j){return(j-c)*g+e};a.domain=function(j){if(!arguments.length)return[e,f];e=j[0];f=j[1];h=1/(f-e);g=(f-e)/(b-c);return a};
<add>a.range=function(j){if(!arguments.length)return[c,b];c=j[0];b=j[1];g=(f-e)/(b-c);i=d3.interpolate(c,b);return a};a.ticks=function(j){j=d(j);return d3.range(j.start,j.stop,j.l)};a.tickFormat=function(j){return d3.format(",."+Math.max(0,-Math.floor(Math.log(d(j).l)/Math.LN10+0.01))+"f")};return a};
<ide> d3.scale.log=function(){function a(c){return Math.log(c)/Math.LN10}function d(c){return Math.pow(10,c)}function e(c){return f(a(c))}var f=d3.scale.linear();e.invert=function(c){return d(f.invert(c))};e.domain=function(c){if(!arguments.length)return f.domain().map(d);f.domain(c.map(a));return e};e.range=function(){var c=f.range.apply(f,arguments);return arguments.length?e:c};e.ticks=function(){var c=f.domain(),b=Math.floor(c[0]),h=Math.ceil(c[1]),g=[];if(c.every(isFinite)){for(;++b<=h;)for(c=1;c<10;c++)g.push(d(b)*
<ide> c);g.push(d(b))}return g};e.tickFormat=function(){return function(c){return c.toPrecision(1)}};return e};
<ide> d3.scale.pow=function(){function a(h){return Math.pow(h,c)}function d(h){return Math.pow(h,b)}function e(h){return f(a(h))}var f=d3.scale.linear(),c=1,b=1/c;e.invert=function(h){return d(f.invert(h))};e.domain=function(h){if(!arguments.length)return f.domain().map(d);f.domain(h.map(a));return e};e.range=function(){var h=f.range.apply(f,arguments);return arguments.length?e:h};e.exponent=function(h){if(!arguments.length)return c;var g=e.domain();c=h;b=1/h;return e.domain(g)};return e};
<ide> d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};
<ide> d3.scale.ordinal=function(){function a(b){b=b in e?e[b]:e[b]=d.push(b)-1;return f[b%f.length]}var d=[],e={},f=[],c=0;a.domain=function(b){if(!arguments.length)return d;d=b;e={};for(var h=-1,g=-1,i=d.length;++h<i;){b=d[h];b in e||(e[b]=++g)}return a};a.range=function(b){if(!arguments.length)return f;f=b;return a};a.rangePoints=function(b,h){if(arguments.length<2)h=0;var g=b[0],i=b[1],j=(i-g)/(d.length-1+h);f=d.length==1?[(g+i)/2]:d3.range(g+j*h/2,i+j/2,j);c=0;return a};a.rangeBands=function(b,h){if(arguments.length<
<del>2)h=0;var g=b[0],i=b[1],j=(i-g)/(d.length+h);f=d3.range(g+j*h,i,j);c=j*(1-h);return a};a.rangeBand=function(){return c};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(qa)};d3.scale.category19=function(){return d3.scale.ordinal().range(ra)};d3.scale.category20=function(){return d3.scale.ordinal().range(sa)};
<del>var qa=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ra=["#9c9ede","#7375b5","#4a5584","#cedb9c","#b5cf6b","#8ca252","#637939","#e7cb94","#e7ba52","#bd9e39","#8c6d31","#e7969c","#d6616b","#ad494a","#843c39","#de9ed6","#ce6dbd","#a55194","#7b4173"],sa=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];
<add>2)h=0;var g=b[0],i=b[1],j=(i-g)/(d.length+h);f=d3.range(g+j*h,i,j);c=j*(1-h);return a};a.rangeBand=function(){return c};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(ra)};d3.scale.category19=function(){return d3.scale.ordinal().range(sa)};d3.scale.category20=function(){return d3.scale.ordinal().range(ta)};
<add>var ra=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sa=["#9c9ede","#7375b5","#4a5584","#cedb9c","#b5cf6b","#8ca252","#637939","#e7cb94","#e7ba52","#bd9e39","#8c6d31","#e7969c","#d6616b","#ad494a","#843c39","#de9ed6","#ce6dbd","#a55194","#7b4173"],ta=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];
<ide> d3.svg={};
<del>d3.svg.arc=function(){function a(b){return b.endAngle}function d(b){return b.startAngle}function e(b){return b.outerRadius}function f(b){return b.innerRadius}function c(b){var h=f(b),g=e(b),i=d(b)-Math.PI/2,j=a(b)-Math.PI/2;b=j-i;var n=Math.cos(i);i=Math.sin(i);var p=Math.cos(j);j=Math.sin(j);return"M"+g*n+","+g*i+"A"+g+","+g+" 0 "+(b<Math.PI?"0":"1")+",1 "+g*p+","+g*j+"L"+h*p+","+h*j+"A"+h+","+h+" 0 "+(b<Math.PI?"0":"1")+",0 "+h*n+","+h*i+"Z"}c.innerRadius=function(b){f=typeof b=="function"?b:function(){return b};
<add>d3.svg.arc=function(){function a(b){return b.endAngle}function d(b){return b.startAngle}function e(b){return b.outerRadius}function f(b){return b.innerRadius}function c(b){var h=f(b),g=e(b),i=d(b)-Math.PI/2,j=a(b)-Math.PI/2;b=j-i;var m=Math.cos(i);i=Math.sin(i);var p=Math.cos(j);j=Math.sin(j);return"M"+g*m+","+g*i+"A"+g+","+g+" 0 "+(b<Math.PI?"0":"1")+",1 "+g*p+","+g*j+"L"+h*p+","+h*j+"A"+h+","+h+" 0 "+(b<Math.PI?"0":"1")+",0 "+h*m+","+h*i+"Z"}c.innerRadius=function(b){f=typeof b=="function"?b:function(){return b};
<ide> return c};c.outerRadius=function(b){e=typeof b=="function"?b:function(){return b};return c};c.startAngle=function(b){d=typeof b=="function"?b:function(){return b};return c};c.endAngle=function(b){a=typeof b=="function"?b:function(){return b};return c};return c};
<ide> d3.svg.line=function(){function a(f){return f.y}function d(f){return f.x}function e(f){var c=[],b=0,h=f[0];for(c.push("M",d.call(this,h,b),",",a.call(this,h,b));h=f[++b];)c.push("L",d.call(this,h,b),",",a.call(this,h,b));return c.join("")}e.x=function(f){d=f;return e};e.y=function(f){a=f;return e};return e};
<ide> d3.svg.area=function(){function a(c){return c.y1}function d(c){return c.x}function e(c){var b=[],h=0,g=c[0];for(b.push("M",d.call(this,g,h),","+f+"V",a.call(this,g,h));g=c[++h];)b.push("L",d.call(this,g,h),",",a.call(this,g,h));b.push("V"+f+"Z");return b.join("")}var f=0;e.x=function(c){d=c;return e};e.y0=function(c){f=c;return e};e.y1=function(c){a=c;return e};return e};
<ide><path>src/core/core.js
<del>d3 = {version: "0.16.2"}; // semver
<add>d3 = {version: "0.17.0"}; // semver
<ide><path>src/core/transition.js
<ide> d3.transition = d3_root.transition;
<ide>
<del>var d3_transitionId = 0;
<add>var d3_transitionId = 0,
<add> d3_transitionInheritId = 0;
<ide>
<ide> function d3_transition(groups) {
<ide> var transition = {},
<del> transitionId = ++d3_transitionId,
<add> transitionId = d3_transitionInheritId || ++d3_transitionId,
<ide> tweens = {},
<ide> interpolators = [],
<add> remove = false,
<ide> event = d3.dispatch("start", "end"),
<ide> stage = [],
<ide> delay = [],
<ide> function d3_transition(groups) {
<ide> } else {
<ide> stage[k] = 2;
<ide> if (tx.active == transitionId) {
<add> var owner = tx.owner;
<ide> for (tk in tweens) ik[tk].call(this, 1);
<del> if (tx.owner == transitionId) {
<add> if (owner == transitionId) {
<ide> delete this.__transition__;
<del> event.end.dispatch.apply(this, arguments);
<add> if (remove) this.parentNode.removeChild(this);
<ide> }
<add> d3_transitionInheritId = transitionId;
<add> event.end.dispatch.apply(this, arguments);
<add> d3_transitionInheritId = 0;
<add> tx.owner = owner;
<ide> }
<ide> }
<ide> });
<ide> function d3_transition(groups) {
<ide> return t;
<ide> };
<ide>
<add> transition.remove = function() {
<add> remove = true;
<add> return transition;
<add> };
<add>
<ide> transition.each = function(type, listener) {
<ide> event[type].add(listener);
<ide> return transition; | 4 |
PHP | PHP | allow multiple request methods for uri | d29a12794815311c46518ede1a94e00198ee5efe | <ide><path>laravel/routing/router.php
<ide> class Router {
<ide> *
<ide> * @var array
<ide> */
<del> public static $fallback = array();
<add> public static $fallback = array(
<add> 'GET' => array(),
<add> 'POST' => array(),
<add> 'PUT' => array(),
<add> 'DELETE' => array(),
<add> 'HEAD' => array(),
<add> );
<ide>
<ide> /**
<ide> * The current attributes being shared by routes.
<ide> class Router {
<ide> *
<ide> * @var array
<ide> */
<del> public static $methods = array('GET', 'POST', 'PUT', 'DELETE');
<add> public static $methods = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD');
<ide>
<ide> /**
<ide> * Register a HTTPS route with the router.
<ide> public static function register($method, $route, $action)
<ide> {
<ide> if (is_string($route)) $route = explode(', ', $route);
<ide>
<add> // If the developer is registering multiple request methods to handle
<add> // the URI, we'll spin through each method and register the route
<add> // for each of them along with each URI.
<add> if (is_array($method))
<add> {
<add> foreach ($method as $http)
<add> {
<add> static::register($http, $route, $action);
<add> }
<add>
<add> return;
<add> }
<add>
<ide> foreach ((array) $route as $uri)
<ide> {
<ide> // If the URI begins with a splat, we'll call the universal method, which | 1 |
Javascript | Javascript | use assert.strictequal instead of assert.equal | 936ac681b2f5cf58cd2f1069ccc1720c7981e00e | <ide><path>test/pseudo-tty/test-tty-get-color-depth.js
<ide> const writeStream = new WriteStream(fd);
<ide>
<ide> {
<ide> const depth = writeStream.getColorDepth();
<del> assert.equal(typeof depth, 'number');
<add> assert.strictEqual(typeof depth, 'number');
<ide> assert(depth >= 1 && depth <= 24);
<ide> }
<ide>
<ide> const writeStream = new WriteStream(fd);
<ide> [{ TERM: 'dumb', COLORTERM: '1' }, 4],
<ide> ].forEach(([env, depth], i) => {
<ide> const actual = writeStream.getColorDepth(env);
<del> assert.equal(
<add> assert.strictEqual(
<ide> actual,
<ide> depth,
<ide> `i: ${i}, expected: ${depth}, actual: ${actual}, env: ${env}`
<ide> const writeStream = new WriteStream(fd);
<ide> const [ value, depth1, depth2 ] = process.platform !== 'win32' ?
<ide> ['win32', 1, 4] : ['linux', 4, 1];
<ide>
<del> assert.equal(writeStream.getColorDepth({}), depth1);
<add> assert.strictEqual(writeStream.getColorDepth({}), depth1);
<ide> Object.defineProperty(process, 'platform', { value });
<del> assert.equal(writeStream.getColorDepth({}), depth2);
<add> assert.strictEqual(writeStream.getColorDepth({}), depth2);
<ide> Object.defineProperty(process, 'platform', platform);
<ide> } | 1 |
Text | Text | add mercari to the company list | 4322d6dae3aa1366131a6b3c3e514369645b3ddd | <ide><path>README.md
<ide> Currently **officially** using Airflow:
<ide> 1. [Madrone](http://madroneco.com/) [[@mbreining](https://github.com/mbreining) & [@scotthb](https://github.com/scotthb)]
<ide> 1. [Markovian](https://markovian.com/) [[@al-xv](https://github.com/al-xv), [@skogsbaeck](https://github.com/skogsbaeck), [@waltherg](https://github.com/waltherg)]
<ide> 1. [Mercadoni](https://www.mercadoni.com.co) [[@demorenoc](https://github.com/demorenoc)]
<add>1. [Mercari](http://www.mercari.com/) [[@yu-iskw](https://github.com/yu-iskw)]
<ide> 1. [MiNODES](https://www.minodes.com) [[@dice89](https://github.com/dice89), [@diazcelsa](https://github.com/diazcelsa)]
<ide> 1. [MFG Labs](https://github.com/MfgLabs)
<ide> 1. [mytaxi](https://mytaxi.com) [[@mytaxi](https://github.com/mytaxi)] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.