Skip to content

Commit

Permalink
refactor: add package exports entry
Browse files Browse the repository at this point in the history
This commit adds the exports entry in each package.json, exposing the public parts of each package and hiding the private ones.
  • Loading branch information
manolakis authored and Joren Broekema committed Feb 15, 2021
1 parent b8e9c92 commit b2f981d
Show file tree
Hide file tree
Showing 78 changed files with 316 additions and 100 deletions.
47 changes: 47 additions & 0 deletions .changeset/red-steaks-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
'babel-plugin-extend-docs': minor
'providence-analytics': minor
'remark-extend': minor
'@lion/accordion': minor
'@lion/ajax': minor
'@lion/button': minor
'@lion/calendar': minor
'@lion/checkbox-group': minor
'@lion/collapsible': minor
'@lion/combobox': minor
'@lion/core': minor
'@lion/dialog': minor
'@lion/fieldset': minor
'@lion/form': minor
'@lion/form-core': minor
'@lion/form-integrations': minor
'@lion/helpers': minor
'@lion/icon': minor
'@lion/input': minor
'@lion/input-amount': minor
'@lion/input-date': minor
'@lion/input-datepicker': minor
'@lion/input-email': minor
'@lion/input-iban': minor
'@lion/input-range': minor
'@lion/input-stepper': minor
'@lion/listbox': minor
'@lion/localize': minor
'@lion/overlays': minor
'@lion/pagination': minor
'@lion/progress-indicator': minor
'@lion/radio-group': minor
'@lion/select': minor
'@lion/select-rich': minor
'singleton-manager': minor
'@lion/steps': minor
'@lion/switch': minor
'@lion/tabs': minor
'@lion/textarea': minor
'@lion/tooltip': minor
'@lion/validate-messages': minor
---

Add exports field in package.json

Note that some tools can break with this change as long as they respect the exports field. If that is the case, check that you always access the elements included in the exports field, with the same name which they are exported. Any item not exported is considered private to the package and should not be accessed from the outside.
3 changes: 2 additions & 1 deletion packages-node/babel-plugin-extend-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
],
"publishConfig": {
"access": "public"
}
},
"exports": "./index.js"
}
4 changes: 4 additions & 0 deletions packages-node/providence-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./src/program/providence.js",
"./src/cli/index.js": "./src/cli/index.js"
}
}
3 changes: 2 additions & 1 deletion packages-node/remark-extend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
],
"publishConfig": {
"access": "public"
}
},
"exports": "./index.js"
}
4 changes: 4 additions & 0 deletions packages/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-accordion": "./lion-accordion.js"
}
}
4 changes: 1 addition & 3 deletions packages/ajax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js"
}
"exports": "./index.js"
}
4 changes: 4 additions & 0 deletions packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-button": "./lion-button.js"
}
}
2 changes: 1 addition & 1 deletion packages/button/src/LionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
LitElement,
SlotMixin,
} from '@lion/core';
import '@lion/core/src/differentKeyEventNamesShimIE.js';
import '@lion/core/differentKeyEventNamesShimIE';

const isKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ' || e.key === 'Enter';
const isSpaceKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ';
Expand Down
2 changes: 1 addition & 1 deletion packages/button/test/lion-button.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { browserDetection } from '@lion/core';
import { aTimeout, expect, fixture, html, oneEvent, unsafeStatic } from '@open-wc/testing';
import sinon from 'sinon';
import '@lion/core/src/differentKeyEventNamesShimIE.js';
import '@lion/core/differentKeyEventNamesShimIE';
import '../lion-button.js';

/**
Expand Down
1 change: 1 addition & 0 deletions packages/calendar/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { isSameDate } from './src/utils/isSameDate.js';
export { LionCalendar } from './src/LionCalendar.js';
5 changes: 5 additions & 0 deletions packages/calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-calendar": "./lion-calendar.js",
"./test-helpers": "./test-helpers.js"
}
}
3 changes: 2 additions & 1 deletion packages/calendar/src/LionCalendar.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { html, LitElement } from '@lion/core';
import '@lion/core/src/differentKeyEventNamesShimIE.js';
import {
getMonthNames,
getWeekdayNames,
localize,
LocalizeMixin,
normalizeDateTime,
} from '@lion/localize';

import '@lion/core/differentKeyEventNamesShimIE';
import { calendarStyle } from './calendarStyle.js';
import { createDay } from './utils/createDay.js';
import { createMultipleMonth } from './utils/createMultipleMonth.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/calendar/test/lion-calendar.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { html } from '@lion/core';
import '@lion/core/test-helpers/keyboardEventShimIE.js';
import { localize } from '@lion/localize';
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import { expect, fixture as _fixture } from '@open-wc/testing';
import sinon from 'sinon';
import '../lion-calendar.js';
Expand Down
6 changes: 6 additions & 0 deletions packages/checkbox-group/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-checkbox": "./lion-checkbox.js",
"./lion-checkbox-group": "./lion-checkbox-group.js",
"./lion-checkbox-indeterminate": "./lion-checkbox-indeterminate.js"
}
}
2 changes: 1 addition & 1 deletion packages/checkbox-group/test/lion-checkbox-group.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import { expect, fixture as _fixture, html } from '@open-wc/testing';
import '../lion-checkbox-group.js';
import '../lion-checkbox.js';
Expand Down
4 changes: 4 additions & 0 deletions packages/collapsible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-collapsible": "./lion-collapsible.js"
}
}
4 changes: 4 additions & 0 deletions packages/combobox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-combobox": "./lion-combobox.js"
}
}
4 changes: 2 additions & 2 deletions packages/combobox/test/lion-combobox.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '@lion/listbox/lion-option.js';
import '@lion/listbox/lion-option';
import { expect, fixture, html, defineCE, unsafeStatic } from '@open-wc/testing';
import sinon from 'sinon';
import '../lion-combobox.js';
import { LionOptions } from '@lion/listbox/src/LionOptions.js';
import { LionOptions } from '@lion/listbox';
import { browserDetection, LitElement } from '@lion/core';
import { Required } from '@lion/form-core';
import { LionCombobox } from '../src/LionCombobox.js';
Expand Down
1 change: 1 addition & 0 deletions packages/core/closestPolyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './src/closestPolyfill.js';
1 change: 1 addition & 0 deletions packages/core/differentKeyEventNamesShimIE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './src/differentKeyEventNamesShimIE.js';
11 changes: 10 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
"prepublishOnly": "../../scripts/npm-prepublish.js",
"test": "cd ../../ && npm run test:browser -- --group core"
},
"sideEffects": false,
"sideEffects": [
"./closestPolyfill.js",
"./differentKeyEventNamesShimIE.js"
],
"dependencies": {
"@open-wc/dedupe-mixin": "^1.2.18",
"@open-wc/scoped-elements": "^1.3.3",
Expand All @@ -42,5 +45,11 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./test-helpers/*": "./test-helpers/*",
"./closestPolyfill": "./src/closestPolyfill.js",
"./differentKeyEventNamesShimIE": "./src/differentKeyEventNamesShimIE.js"
}
}
4 changes: 4 additions & 0 deletions packages/dialog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-dialog": "./lion-dialog.js"
}
}
4 changes: 4 additions & 0 deletions packages/fieldset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./lion-fieldset": "./lion-fieldset.js"
}
}
7 changes: 7 additions & 0 deletions packages/form-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,12 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": "./index.js",
"./test-helpers/*": "./test-helpers/*",
"./test-suites/*": "./test-suites/*",
"./lion-field": "./lion-field.js",
"./lion-validation-feedback": "./lion-validation-feedback.js"
}
}
3 changes: 1 addition & 2 deletions packages/form-core/src/FormControlMixin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { css, dedupeMixin, html, nothing, SlotMixin } from '@lion/core';
import { DisabledMixin } from '@lion/core/src/DisabledMixin.js';
import { css, dedupeMixin, html, nothing, SlotMixin, DisabledMixin } from '@lion/core';
import { FormRegisteringMixin } from './registration/FormRegisteringMixin.js';
import { getAriaElementsInRightDomOrder } from './utils/getAriaElementsInRightDomOrder.js';
import { Unparseable } from './validate/Unparseable.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement } from '@lion/core';
import { localize } from '@lion/localize';
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import { defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
import sinon from 'sinon';
import { DefaultSuccess, MinLength, Required, ValidateMixin, Validator } from '../index.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement } from '@lion/core';
import { LionInput } from '@lion/input';
import '@lion/fieldset/lion-fieldset.js';
import '@lion/fieldset/lion-fieldset';
import { FormGroupMixin, Required } from '@lion/form-core';
import { expect, html, fixture, unsafeStatic } from '@open-wc/testing';
import { ChoiceGroupMixin } from '../../src/choice-group/ChoiceGroupMixin.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LitElement } from '@lion/core';
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import { defineCE, expect, html, unsafeStatic, fixture } from '@open-wc/testing';
import { LionInput } from '@lion/input';
import '@lion/form-core/lion-field.js';
import '@lion/form-core/lion-field';
import { FormGroupMixin } from '../../src/form-group/FormGroupMixin.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement } from '@lion/core';
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import {
defineCE,
expect,
Expand All @@ -11,7 +11,7 @@ import {
} from '@open-wc/testing';
import sinon from 'sinon';
import { IsNumber, Validator, LionField } from '@lion/form-core';
import '@lion/form-core/lion-field.js';
import '@lion/form-core/lion-field';
import { FormGroupMixin } from '../../src/form-group/FormGroupMixin.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/form-core/test/lion-field.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { unsafeHTML } from '@lion/core';
import { localize } from '@lion/localize';
import { localizeTearDown } from '@lion/localize/test-helpers.js';
import { localizeTearDown } from '@lion/localize/test-helpers';
import { Required, Validator } from '@lion/form-core';
import {
expect,
Expand Down
3 changes: 2 additions & 1 deletion packages/form-integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
],
"publishConfig": {
"access": "public"
}
},
"exports": "./index.js"
}
38 changes: 19 additions & 19 deletions packages/form-integrations/test/helpers/umbrella-form.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { LitElement, html } from '@lion/core';
import { Required, MinLength } from '@lion/form-core';
import '@lion/form/lion-form.js';
import '@lion/fieldset/lion-fieldset.js';
import '@lion/input/lion-input.js';
import '@lion/input-date/lion-input-date.js';
import '@lion/input-datepicker/lion-input-datepicker.js';
import '@lion/input-amount/lion-input-amount.js';
import '@lion/input-iban/lion-input-iban.js';
import '@lion/input-email/lion-input-email.js';
import '@lion/checkbox-group/lion-checkbox-group.js';
import '@lion/checkbox-group/lion-checkbox.js';
import '@lion/radio-group/lion-radio-group.js';
import '@lion/radio-group/lion-radio.js';
import '@lion/select/lion-select.js';
import '@lion/select-rich/lion-select-rich.js';
import '@lion/select-rich/lion-options.js';
import '@lion/select-rich/lion-option.js';
import '@lion/input-range/lion-input-range.js';
import '@lion/textarea/lion-textarea.js';
import '@lion/button/lion-button.js';
import '@lion/form/lion-form';
import '@lion/fieldset/lion-fieldset';
import '@lion/input/lion-input';
import '@lion/input-date/lion-input-date';
import '@lion/input-datepicker/lion-input-datepicker';
import '@lion/input-amount/lion-input-amount';
import '@lion/input-iban/lion-input-iban';
import '@lion/input-email/lion-input-email';
import '@lion/checkbox-group/lion-checkbox-group';
import '@lion/checkbox-group/lion-checkbox';
import '@lion/radio-group/lion-radio-group';
import '@lion/radio-group/lion-radio';
import '@lion/select/lion-select';
import '@lion/select-rich/lion-select-rich';
import '@lion/select-rich/lion-options';
import '@lion/select-rich/lion-option';
import '@lion/input-range/lion-input-range';
import '@lion/textarea/lion-textarea';
import '@lion/button/lion-button';

export class UmbrellaForm extends LitElement {
get _lionFormNode() {
Expand Down

0 comments on commit b2f981d

Please sign in to comment.