Skip to content

Commit

Permalink
perf: remove default array/object polyfills (bootstrap-vue#3641)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmllr95 authored and tmorehouse committed Jul 8, 2019
1 parent d3641ba commit 8b34bf2
Show file tree
Hide file tree
Showing 8 changed files with 962 additions and 491 deletions.
5 changes: 2 additions & 3 deletions docs/markdown/intro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,9 @@ sizes when using the `ESM` module _vs._ the `ESM` bundle.
### Dependencies

BootstrapVue relies on `Popper.js` (for Tooltip, Popover, and Dropdown positioning), `PortalVue`
(for toasts), and
(for toasts) and
[`vue-functional-data-merge`](https://github.com/alexsasharegan/vue-functional-data-merge) (used by
our functional components) and parts of `core-js`. These four dependencies are included in the `UMD`
bundle.
our functional components). These three dependencies are included in the `UMD` bundle.

## Migrating a project already using Bootstrap

Expand Down
3 changes: 2 additions & 1 deletion docs/markdown/reference/starter-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ created when you run `yarn build`.

### Importing individual components and directives

As an example, you can import `<b-card>` (plus some of it's sub components) and `<b-table>` as follows:
As an example, you can import `<b-card>` (plus some of it's sub components) and `<b-table>` as
follows:

```js
// Import the individual components
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"dependencies": {
"@nuxt/opencollective": "^0.2.2",
"bootstrap": "^4.3.1",
"core-js": ">=2.6.5 <3.0.0",
"popper.js": "^1.15.0",
"portal-vue": "^2.1.5",
"vue-functional-data-merge": "^3.1.0"
Expand All @@ -97,6 +96,7 @@
"codecov": "^3.5.0",
"codemirror": "^5.48.0",
"codesandbox": "^2.1.6",
"core-js": ">=2.6.5 <3.0.0",
"cross-env": "^5.2.0",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const externals = ['vue', ...Object.keys(dependencies)]
// are expected to be provided later.
// In some cases (i.e. browser UMD build), we want to include some of
// them in the build, so we exclude the external here.
const externalExcludes = ['core-js', 'popper.js', 'portal-vue', 'vue-functional-data-merge']
const externalExcludes = ['popper.js', 'portal-vue', 'vue-functional-data-merge']

// The base rollup configuration
const baseConfig = {
Expand All @@ -36,7 +36,7 @@ export default [
// UMD Browser Build
{
...baseConfig,
// We use a specific input entrypoint for the browser build
// We use a specific input for the browser build
input: path.resolve(src, 'browser.js'),
external: externals.filter(dep => !externalExcludes.includes(dep)),
output: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/nav/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ The dropdown default slot is optionally scoped with the following scope availabl

By default, `<b-nav-item-dropdown>` renders the menu contents in the DOM even when the menu is not
shown. When there are a large number of dropdowns rendered on the same page, performance could be
impacted due to larger overall memory utilization. You can instruct `<b-nav-item-dropdown>` to render
the menu contents only when it is shown by setting the `lazy` prop to true.
impacted due to larger overall memory utilization. You can instruct `<b-nav-item-dropdown>` to
render the menu contents only when it is shown by setting the `lazy` prop to true.

## Using in navbar

Expand Down
7 changes: 2 additions & 5 deletions src/utils/array.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fromPolyfill from 'core-js/library/fn/array/from'
import isArrayPolyfill from 'core-js/library/fn/array/is-array'

// --- Static ---

export const from = Array.from || fromPolyfill
export const isArray = Array.isArray || isArrayPolyfill
export const from = Array.from
export const isArray = Array.isArray

// --- Instance ---

Expand Down
6 changes: 2 additions & 4 deletions src/utils/object.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import assignPolyfill from 'core-js/library/fn/object/assign'
import isPolyfill from 'core-js/library/fn/object/is'
import { isArray } from './array'

// --- Static ---

export const assign = Object.assign || assignPolyfill
export const assign = Object.assign
export const getOwnPropertyNames = Object.getOwnPropertyNames
export const keys = Object.keys
export const defineProperties = Object.defineProperties
Expand All @@ -15,7 +13,7 @@ export const getOwnPropertySymbols = Object.getOwnPropertySymbols
export const getPrototypeOf = Object.getPrototypeOf
export const create = Object.create
export const isFrozen = Object.isFrozen
export const is = Object.is || isPolyfill
export const is = Object.is

// --- "Instance" ---

Expand Down
Loading

0 comments on commit 8b34bf2

Please sign in to comment.