Skip to content

Commit 447b2d7

Browse files
committed
fix(tools): workspaces in dev server
resolve pfe packages from dependant monorepos as well as from pfe monorepo herself remove esbuild export condition from packages
1 parent f26d5ab commit 447b2d7

File tree

41 files changed

+235
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+235
-403
lines changed

.changeset/hip-cats-change.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
"@patternfly/pfe-tools": major
3+
---
4+
5+
Remove support for custom `esbuild` export condition
6+
7+
Previously, the dev-server config would try to import typescript sources using
8+
the `esbuild` export condition, but this proved awkward when daughter repos
9+
would try to import the same packages by the esbuild condition, only to
10+
discover that there was no typescript source file because it was compiled away
11+
before hitting NPM
12+
13+
Therefore, removed export conditions entirely and now rely on a hacky mod to
14+
the built-in web dev server node-resolution algorithm
15+
16+
In our tests, this appeared to work in both primary cases:
17+
1. Developing local packages in `patternfly/patternfly-elements`
18+
2. Developing local packages in a 'daughter' repo which installed
19+
`@patternfly/pfe-tools`
20+
21+
If you find that you're getting 404 errors to modules you're sure exist, or
22+
other such weird behaviour when resolving js sources from your monorepo, please
23+
open a [new
24+
issue](https://github.com/patternfly/patternfly-elements/issues/new/choose)

.changeset/silver-fans-lie.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
"@patternfly/pfe-core": patch
3+
"@patternfly/pfe-accordion": patch
4+
"@patternfly/pfe-autocomplete": patch
5+
"@patternfly/pfe-avatar": patch
6+
"@patternfly/pfe-badge": patch
7+
"@patternfly/pfe-band": patch
8+
"@patternfly/pfe-button": patch
9+
"@patternfly/pfe-card": patch
10+
"@patternfly/pfe-clipboard": patch
11+
"@patternfly/pfe-codeblock": patch
12+
"@patternfly/pfe-collapse": patch
13+
"@patternfly/pfe-cta": patch
14+
"@patternfly/pfe-datetime": patch
15+
"@patternfly/pfe-dropdown": patch
16+
"@patternfly/pfe-health-index": patch
17+
"@patternfly/pfe-icon": patch
18+
"@patternfly/pfe-icon-panel": patch
19+
"@patternfly/pfe-jump-links": patch
20+
"@patternfly/pfe-label": patch
21+
"@patternfly/pfe-markdown": patch
22+
"@patternfly/pfe-modal": patch
23+
"@patternfly/pfe-number": patch
24+
"@patternfly/pfe-page-status": patch
25+
"@patternfly/pfe-primary-detail": patch
26+
"@patternfly/pfe-progress-indicator": patch
27+
"@patternfly/pfe-progress-steps": patch
28+
"@patternfly/pfe-readtime": patch
29+
"@patternfly/pfe-select": patch
30+
"@patternfly/pfe-tabs": patch
31+
"@patternfly/pfe-toast": patch
32+
"@patternfly/create-element": patch
33+
---
34+
35+
Remove `esbuild` export condition, as this anyways was a runtime error

core/pfe-core/package.json

Lines changed: 23 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -9,98 +9,29 @@
99
"module": "./core.js",
1010
"types": "./core.d.ts",
1111
"exports": {
12-
".": {
13-
"esbuild": "./core.ts",
14-
"default": "./core.js"
15-
},
16-
"./core.js": {
17-
"esbuild": "./core.ts",
18-
"default": "./core.js"
19-
},
20-
"./context.js": {
21-
"esbuild": "./context.ts",
22-
"default": "./context.js"
23-
},
24-
"./decorators.js": {
25-
"esbuild": "./decorators.ts",
26-
"default": "./decorators.js"
27-
},
28-
"./controllers/cascade-controller.js": {
29-
"esbuild": "./controllers/cascade-controller.ts",
30-
"default": "./controllers/cascade-controller.js"
31-
},
32-
"./controllers/color-context-controller.js": {
33-
"esbuild": "./controllers/color-context-controller.ts",
34-
"default": "./controllers/color-context-controller.js"
35-
},
36-
"./controllers/css-variable-controller.js": {
37-
"esbuild": "./controllers/css-variable-controller.ts",
38-
"default": "./controllers/css-variable-controller.js"
39-
},
40-
"./controllers/light-dom-controller.js": {
41-
"esbuild": "./controllers/light-dom-controller.ts",
42-
"default": "./controllers/light-dom-controller.js"
43-
},
44-
"./controllers/logger.js": {
45-
"esbuild": "./controllers/logger.ts",
46-
"default": "./controllers/logger.js"
47-
},
48-
"./controllers/perf-controller.js": {
49-
"esbuild": "./controllers/perf-controller.ts",
50-
"default": "./controllers/perf-controller.js"
51-
},
52-
"./controllers/property-observer-controller.js": {
53-
"esbuild": "./controllers/property-observer-controller.ts",
54-
"default": "./controllers/property-observer-controller.js"
55-
},
56-
"./controllers/slot-controller.js": {
57-
"esbuild": "./controllers/slot-controller.ts",
58-
"default": "./controllers/slot-controller.js"
59-
},
60-
"./controllers/style-controller.js": {
61-
"esbuild": "./controllers/style-controller.ts",
62-
"default": "./controllers/style-controller.js"
63-
},
64-
"./decorators/bound.js": {
65-
"esbuild": "./decorators/bound.ts",
66-
"default": "./decorators/bound.js"
67-
},
68-
"./decorators/cascades.js": {
69-
"esbuild": "./decorators/cascades.ts",
70-
"default": "./decorators/cascades.js"
71-
},
72-
"./decorators/initializer.js": {
73-
"esbuild": "./decorators/initializer.ts",
74-
"default": "./decorators/initializer.js"
75-
},
76-
"./decorators/observed.js": {
77-
"esbuild": "./decorators/observed.ts",
78-
"default": "./decorators/observed.js"
79-
},
80-
"./decorators/pfelement.js": {
81-
"esbuild": "./decorators/pfelement.ts",
82-
"default": "./decorators/pfelement.js"
83-
},
84-
"./decorators/time.js": {
85-
"esbuild": "./decorators/time.ts",
86-
"default": "./decorators/time.js"
87-
},
88-
"./decorators/trace.js": {
89-
"esbuild": "./decorators/trace.ts",
90-
"default": "./decorators/trace.js"
91-
},
92-
"./functions/debounce.js": {
93-
"esbuild": "./functions/debounce.ts",
94-
"default": "./functions/debounce.js"
95-
},
96-
"./functions/deprecateCustomEvent.js": {
97-
"esbuild": "./functions/deprecateCustomEvent.ts",
98-
"default": "./functions/deprecateCustomEvent.js"
99-
},
100-
"./functions/random.js": {
101-
"esbuild": "./functions/random.ts",
102-
"default": "./functions/random.js"
103-
}
12+
".": "./core.js",
13+
"./core.js": "./core.js",
14+
"./context.js": "./context.js",
15+
"./decorators.js": "./decorators.js",
16+
"./controllers/cascade-controller.js": "./controllers/cascade-controller.js",
17+
"./controllers/color-context-controller.js": "./controllers/color-context-controller.js",
18+
"./controllers/css-variable-controller.js": "./controllers/css-variable-controller.js",
19+
"./controllers/light-dom-controller.js": "./controllers/light-dom-controller.js",
20+
"./controllers/logger.js": "./controllers/logger.js",
21+
"./controllers/perf-controller.js": "./controllers/perf-controller.js",
22+
"./controllers/property-observer-controller.js": "./controllers/property-observer-controller.js",
23+
"./controllers/slot-controller.js": "./controllers/slot-controller.js",
24+
"./controllers/style-controller.js": "./controllers/style-controller.js",
25+
"./decorators/bound.js": "./decorators/bound.js",
26+
"./decorators/cascades.js": "./decorators/cascades.js",
27+
"./decorators/initializer.js": "./decorators/initializer.js",
28+
"./decorators/observed.js": "./decorators/observed.js",
29+
"./decorators/pfelement.js": "./decorators/pfelement.js",
30+
"./decorators/time.js": "./decorators/time.js",
31+
"./decorators/trace.js": "./decorators/trace.js",
32+
"./functions/debounce.js": "./functions/debounce.js",
33+
"./functions/deprecatedCustomEvent.js": "./functions/deprecatedCustomEvent.js",
34+
"./functions/random.js": "./functions/random.js"
10435
},
10536
"publishConfig": {
10637
"access": "public",

docs/demo/demo.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import 'html-include-element';
2+
import 'api-viewer-element';
3+
import '@vaadin/split-layout';
4+
15
import { html, render } from 'lit';
26
import { core, elements } from '@patternfly/pfe-tools/environment.js';
37
import { URLPattern } from 'urlpattern-polyfill';

elements/pfe-accordion/demo/pfe-accordion.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '@patternfly/pfe-accordion';
12
import '@patternfly/pfe-band';
23
import '@patternfly/pfe-button';
34
import '@patternfly/pfe-card';

elements/pfe-accordion/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@
99
"module": "./pfe-accordion.js",
1010
"types": "./pfe-accordion.d.ts",
1111
"exports": {
12-
".": {
13-
"esbuild": "./pfe-accordion.ts",
14-
"default": "./pfe-accordion.js"
15-
},
16-
"./*": {
17-
"esbuild": "./*.ts",
18-
"default": "./*.js"
19-
}
12+
".": "./pfe-accordion.js",
13+
"./*": "./*.js"
2014
},
2115
"publishConfig": {
2216
"access": "public",

elements/pfe-autocomplete/package.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,9 @@
99
"module": "./pfe-autocomplete.js",
1010
"types": "./pfe-autocomplete.d.ts",
1111
"exports": {
12-
".": {
13-
"esbuild": "./pfe-autocomplete.ts",
14-
"default": "./pfe-autocomplete.js"
15-
},
16-
"./*": {
17-
"esbuild": "./*.ts",
18-
"default": "./*.js"
19-
},
20-
"./*.js": {
21-
"esbuild": "./*.ts",
22-
"default": "./*.js"
23-
}
12+
".": "./pfe-autocomplete.js",
13+
"./*": "./*.js",
14+
"./*.js": "./*.js"
2415
},
2516
"publishConfig": {
2617
"access": "public",

elements/pfe-avatar/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@
88
"module": "./pfe-avatar.js",
99
"types": "./pfe-avatar.d.ts",
1010
"exports": {
11-
".": {
12-
"esbuild": "./pfe-avatar.ts",
13-
"default": "./pfe-avatar.js"
14-
},
15-
"./*": {
16-
"esbuild": "./*.ts",
17-
"default": "./*.js"
18-
}
11+
".": "./pfe-avatar.js",
12+
"./*": "./*.js"
1913
},
2014
"publishConfig": {
2115
"access": "public",

elements/pfe-badge/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@
99
"module": "./pfe-badge.js",
1010
"types": "./pfe-badge.d.ts",
1111
"exports": {
12-
".": {
13-
"esbuild": "./pfe-badge.ts",
14-
"default": "./pfe-badge.js"
15-
},
16-
"./*": {
17-
"esbuild": "./*.ts",
18-
"default": "./*.js"
19-
}
12+
".": "./pfe-badge.js",
13+
"./*": "./*.js"
2014
},
2115
"publishConfig": {
2216
"access": "public",

elements/pfe-band/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@
99
"module": "./pfe-band.js",
1010
"types": "./pfe-band.d.ts",
1111
"exports": {
12-
".": {
13-
"esbuild": "./pfe-band.ts",
14-
"default": "./pfe-band.js"
15-
},
16-
"./*": {
17-
"esbuild": "./*.ts",
18-
"default": "./*.js"
19-
}
12+
".": "./pfe-band.js",
13+
"./*": "./*.js"
2014
},
2115
"publishConfig": {
2216
"access": "public",

0 commit comments

Comments
 (0)