Skip to content

Commit

Permalink
refactor(vue): replace instantsearch.js with instantsearch-core
Browse files Browse the repository at this point in the history
[FX-3069]

BREAKING CHANGE: if you are using any internal instantsearch.js functions, ensure to update to instantsearch-core to avoid duplication
  • Loading branch information
Haroenv committed Nov 15, 2024
1 parent 8a4d0cb commit f92141f
Show file tree
Hide file tree
Showing 54 changed files with 153 additions and 194 deletions.
2 changes: 1 addition & 1 deletion examples/vue/default-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"algoliasearch": "5.1.1",
"core-js": "2",
"instantsearch.js": "4.75.3",
"instantsearch-core": "0.1.0",
"vue": "2.7.14",
"vue-instantsearch": "4.19.9"
},
Expand Down
5 changes: 2 additions & 3 deletions examples/vue/default-theme/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@

<script>
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
import { simple as simpleMapping } from 'instantsearch.js/es/lib/stateMappings';
import { historyRouter, simpleStateMapping } from 'instantsearch-core';
import './App.css';
Expand All @@ -140,7 +139,7 @@ export default {
router: historyRouter({
cleanUrlOnDispose: false,
}),
stateMapping: simpleMapping(),
stateMapping: simpleStateMapping(),
},
};
},
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"algoliasearch": "5.1.1",
"core-js": "2",
"instantsearch.js": "4.75.3",
"instantsearch-core": "0.1.0",
"vue": "2.7.14",
"vue-instantsearch": "4.19.9",
"vue-slider-component": "3.0.32"
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/e-commerce/src/routing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable camelcase */
/* eslint-disable complexity */
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
import { historyRouter } from 'instantsearch-core';

const hitsPerPageItemsValue = [16, 32, 64];

Expand Down
2 changes: 1 addition & 1 deletion examples/vue/e-commerce/src/widgets/ClearRefinements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</template>

<script>
import { connectClearRefinements } from 'instantsearch.js/es/connectors';
import { connectClearRefinements } from 'instantsearch-core';
import { createWidgetMixin } from 'vue-instantsearch';
export default {
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/e-commerce/src/widgets/NoResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</template>

<script>
import { connectHits } from 'instantsearch.js/es/connectors';
import { connectHits } from 'instantsearch-core';
import { createWidgetMixin } from 'vue-instantsearch';
export default {
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"algoliasearch": "5.1.1",
"core-js": "2",
"instantsearch.js": "4.75.3",
"instantsearch-core": "0.1.0",
"vue": "2.7.14",
"vue-instantsearch": "4.19.9"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"algoliasearch": "5.1.1",
"core-js": "2",
"instantsearch.js": "4.75.3",
"instantsearch-core": "0.1.0",
"vue": "2.7.14",
"vue-instantsearch": "4.19.9"
},
Expand Down
5 changes: 2 additions & 3 deletions examples/vue/media/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@

<script>
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
import { simple as simpleMapping } from 'instantsearch.js/es/lib/stateMappings';
import { historyRouter, simpleStateMapping } from 'instantsearch-core';
import './App.css';
Expand All @@ -129,7 +128,7 @@ export default {
router: historyRouter({
cleanUrlOnDispose: false,
}),
stateMapping: simpleMapping(),
stateMapping: simpleStateMapping(),
},
};
},
Expand Down
73 changes: 0 additions & 73 deletions packages/vue-instantsearch/__mocks__/instantsearch.js/es.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/vue-instantsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"instantsearch-ui-components": "0.9.0",
"instantsearch.js": "4.75.3",
"instantsearch-core": "0.1.0",
"mitt": "^2.1.0"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
connectRatingMenu,
connectRefinementList,
connectToggleRefinement,
} from 'instantsearch.js/es/connectors';
} from 'instantsearch-core';

import { nextTick, mountApp } from '../../test/utils';
import {
Expand All @@ -24,7 +24,6 @@ import {
createWidgetMixin,
} from '../instantsearch';
import { renderCompat } from '../util/vue-compat';
jest.unmock('instantsearch.js/es');

const testSetups = {
async createRefinementListConnectorTests({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { runTestSuites } from '@instantsearch/tests/common';
import * as testSuites from '@instantsearch/tests/shared';
import { connectMenu, connectPagination } from 'instantsearch.js/es/connectors';
import { connectMenu, connectPagination } from 'instantsearch-core';

import { nextTick, mountApp } from '../../test/utils';
import {
Expand All @@ -14,7 +14,6 @@ import {
createWidgetMixin,
} from '../instantsearch';
import { renderCompat } from '../util/vue-compat';
jest.unmock('instantsearch.js/es');

const testSetups = {
async createSharedTests({ instantSearchOptions, widgetParams }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import {
} from '../instantsearch';
import { renderCompat } from '../util/vue-compat';

jest.unmock('instantsearch.js/es');

/**
* prevent rethrowing InstantSearch errors, so tests can be asserted.
* IRL this isn't needed, as the error doesn't stop execution.
Expand Down Expand Up @@ -327,8 +325,8 @@ const testSetups = {

return {
algoliaAgents: [
`instantsearch.js (${
require('../../../instantsearch.js/package.json').version
`instantsearch-core (${
require('../../../instantsearch-core/package.json').version
})`,
`Vue InstantSearch (${
require('../../../vue-instantsearch/package.json').version
Expand Down
7 changes: 2 additions & 5 deletions packages/vue-instantsearch/src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

/* eslint-disable jest/no-conditional-expect */
import { createSearchClient } from '@instantsearch/mocks';

import { mount } from '../../test/utils';
import InstantSearch from '../instantsearch';
Expand Down Expand Up @@ -86,11 +87,7 @@ function getAllComponents() {
{
props: {
indexName: 'instant_search',
searchClient: {
search() {
return new Promise({ results: [] });
},
},
searchClient: createSearchClient(),
},
},
[
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</template>

<script>
import { connectAutocomplete } from 'instantsearch.js/es/connectors';
import { connectAutocomplete } from 'instantsearch-core';
import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</template>

<script>
import { connectBreadcrumb } from 'instantsearch.js/es/connectors';
import { connectBreadcrumb } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>

<script>
import { connectClearRefinements } from 'instantsearch.js/es/connectors';
import { connectClearRefinements } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Configure.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { connectConfigure } from 'instantsearch.js/es/connectors';
import { connectConfigure } from 'instantsearch-core';

import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</template>

<script>
import { connectCurrentRefinements } from 'instantsearch.js/es/connectors';
import { connectCurrentRefinements } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { connectDynamicWidgets } from 'instantsearch.js/es/connectors';
import { connectDynamicWidgets } from 'instantsearch-core';

import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</template>

<script>
import { connectHierarchicalMenu } from 'instantsearch.js/es/connectors';
import { connectHierarchicalMenu } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-instantsearch/src/components/Highlighter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createHighlightComponent } from 'instantsearch-ui-components';
import {
getHighlightedParts,
getPropertyByPath,
unescape,
} from 'instantsearch.js/es/lib/utils';
} from 'instantsearch-core';
import { createHighlightComponent } from 'instantsearch-ui-components';

import { createElement, Fragment } from '../util/pragma';

Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Hits.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { connectHits } from 'instantsearch-core';
import { createHitsComponent } from 'instantsearch-ui-components';
import { connectHits } from 'instantsearch.js/es/connectors';

import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/HitsPerPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</template>

<script>
import { connectHitsPerPage } from 'instantsearch.js/es/connectors';
import { connectHitsPerPage } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import indexWidget from 'instantsearch.js/es/widgets/index/index';
import { index as indexWidget } from 'instantsearch-core';

import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/InfiniteHits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</template>

<script>
import { connectInfiniteHits } from 'instantsearch.js/es/connectors';
import { connectInfiniteHits } from 'instantsearch-core';
import { createSuitMixin } from '../mixins/suit';
import { createWidgetMixin } from '../mixins/widget';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/InstantSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import instantsearch from 'instantsearch.js/es';
import { instantsearch } from 'instantsearch-core';

import { createInstantSearchComponent } from '../util/createInstantSearchComponent';
import { renderCompat, getDefaultSlot } from '../util/vue-compat';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</template>

<script>
import { connectMenu } from 'instantsearch.js/es/connectors';
import { connectMenu } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/MenuSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</template>

<script>
import { connectMenu } from 'instantsearch.js/es/connectors';
import { connectMenu } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/NumericMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</template>

<script>
import { connectNumericMenu } from 'instantsearch.js/es/connectors';
import { connectNumericMenu } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-instantsearch/src/components/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
</template>

<script>
import { connectPagination } from 'instantsearch.js/es/connectors';
import { connectPagination } from 'instantsearch-core';
import { createPanelConsumerMixin } from '../mixins/panel';
import { createSuitMixin } from '../mixins/suit';
Expand Down
Loading

0 comments on commit f92141f

Please sign in to comment.