-
Notifications
You must be signed in to change notification settings - Fork 235
chore(barebones): improve infrastructure and testing setup #5811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: barebones
Are you sure you want to change the base?
Changes from all commits
c1e29e6
6edf67c
78be0e9
2c87343
bf14111
fdc728f
6c6f5d2
a6303d3
460123d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,76 +9,4 @@ | |
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
| import { PropertyValues, ReactiveElement } from 'lit'; | ||
| import { property } from 'lit/decorators.js'; | ||
|
|
||
| type Constructor<T = Record<string, unknown>> = { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| new (...args: any[]): T; | ||
| prototype: T; | ||
| }; | ||
|
|
||
| export type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'; | ||
| export const ElementSizes: Record<string, ElementSize> = { | ||
| xxs: 'xxs', | ||
| xs: 'xs', | ||
| s: 's', | ||
| m: 'm', | ||
| l: 'l', | ||
| xl: 'xl', | ||
| xxl: 'xxl', | ||
| }; | ||
| export type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>; | ||
|
|
||
| export interface SizedElementInterface { | ||
| size: ElementSize; | ||
| } | ||
|
|
||
| export function SizedMixin<T extends Constructor<ReactiveElement>>( | ||
| constructor: T, | ||
| { | ||
| validSizes = ['s', 'm', 'l', 'xl'], | ||
| noDefaultSize, | ||
| defaultSize = 'm', | ||
| }: { | ||
| validSizes?: ElementSize[]; | ||
| noDefaultSize?: boolean; | ||
| defaultSize?: ElementSize; | ||
| } = {} | ||
| ): T & Constructor<SizedElementInterface> { | ||
| class SizedElement extends constructor { | ||
| @property({ type: String }) | ||
| public get size(): ElementSize { | ||
| return this._size || defaultSize; | ||
| } | ||
|
|
||
| public set size(value: ElementSize) { | ||
| const fallbackSize = noDefaultSize ? null : defaultSize; | ||
| const size = ( | ||
| value ? value.toLocaleLowerCase() : value | ||
| ) as ElementSize; | ||
| const validSize = ( | ||
| validSizes.includes(size) ? size : fallbackSize | ||
| ) as ElementSize; | ||
| if (validSize) { | ||
| this.setAttribute('size', validSize); | ||
| } | ||
| if (this._size === validSize) { | ||
| return; | ||
| } | ||
| const oldSize = this._size; | ||
| this._size = validSize; | ||
| this.requestUpdate('size', oldSize); | ||
| } | ||
|
|
||
| private _size: ElementSize | null = defaultSize; | ||
|
|
||
| protected override update(changes: PropertyValues): void { | ||
| if (!this.hasAttribute('size') && !noDefaultSize) { | ||
| this.setAttribute('size', this.size); | ||
| } | ||
| super.update(changes); | ||
| } | ||
| } | ||
| return SizedElement; | ||
| } | ||
| export * from '@swc/core/shared/base/sizedMixin.js'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had forgotten to re-export this from 2nd-gen, now that it is there :) |
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| diff --git a/node_modules/@web/test-runner-coverage-v8/dist/index.js b/node_modules/@web/test-runner-coverage-v8/dist/index.js | ||
| index 997bcfc..b19cf60 100644 | ||
| --- a/node_modules/@web/test-runner-coverage-v8/dist/index.js | ||
| +++ b/node_modules/@web/test-runner-coverage-v8/dist/index.js | ||
| @@ -63,7 +63,16 @@ async function v8ToIstanbul(config, testFiles, coverage, userAgent) { | ||
| !path.startsWith('/__web-test-runner') && | ||
| !path.startsWith('/__web-dev-server')) { | ||
| try { | ||
| - const filePath = (0, path_1.join)(config.rootDir, (0, utils_1.toFilePath)(path)); | ||
| + // Handle __wds-outside-root__ paths which reference files outside the rootDir | ||
| + let filePath; | ||
| + const outsideRootMatch = path.match(/^\/__wds-outside-root__\/\d+\/(.+)$/); | ||
| + if (outsideRootMatch) { | ||
| + // For outside-root files, resolve relative to workspace root (parent of rootDir) | ||
| + const workspaceRoot = (0, path_1.dirname)(config.rootDir); | ||
| + filePath = (0, path_1.join)(workspaceRoot, (0, utils_1.toFilePath)(outsideRootMatch[1])); | ||
| + } else { | ||
| + filePath = (0, path_1.join)(config.rootDir, (0, utils_1.toFilePath)(path)); | ||
| + } | ||
| if (!testFiles.includes(filePath) && included(filePath) && !excluded(filePath)) { | ||
| const browserUrl = `${url.pathname}${url.search}${url.hash}`; | ||
| const cachedSource = cachedSources.get(browserUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
web-dev-serverdoes not automatically pass theprocess.envresolution to the imported modules, so we need this middleware to manually handle it.