Skip to content

Commit

Permalink
fix(polyfill): fix feature detection for Constructable Stylesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed May 19, 2021
1 parent af0c78b commit 7f5b1ec
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"version": "npm run generate:all && git add .",
"release": "np --no-cleanup --no-yarn",
"update:check": "npx npm-check-updates -x np --dep dev,prod",
"update:commit": "npx npm-check-updates -u -x np --dep dev,prod && npm update && npm install"
"update:commit": "npx npm-check-updates -u -x np --dep dev,prod && npm update --force && npm install --force"
},
"keywords": [
"polyfills",
Expand Down
3 changes: 3 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import {Buffer} from "buffer";
import {booleanize} from "../api/util";
import {LogLevel} from "../service/logger/i-logger-service";
import {parseLogLevel} from "../api/util/util";
import pkg from "../../package.json";

export interface Config {
version: string;
sentryDsn: string | undefined;
environment: string;
production: boolean;
Expand All @@ -20,6 +22,7 @@ export interface Config {
}

export const config: Config = {
version: `${pkg.name}@${pkg.version}:${Date.now()}`,
sentryDsn: environment.SENTRY_DSN,
environment: environment.NODE_ENV,
production: environment.NODE_ENV != null && environment.NODE_ENV.toLowerCase() === "production",
Expand Down
2 changes: 1 addition & 1 deletion src/constant/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3253,7 +3253,7 @@ export const constant: IConstant = {
"constructable-style-sheets": {
library: "construct-style-sheets-polyfill",
relativePaths: ["dist/adoptedStyleSheets.js"],
features: ["api.DocumentOrShadowRoot.adoptedStyleSheets"],
features: ["api.Document.adoptedStyleSheets", "api.ShadowRoot.adoptedStyleSheets"],

dependencies: ["shadow-dom"],
contexts: ALL_CONTEXTS
Expand Down
1 change: 1 addition & 0 deletions src/service/metrics/sentry-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class SentryService implements IMetricsService {
init({
dsn: this.config.sentryDsn,
environment: this.config.environment,
release: this.config.version,
integrations: [
// enable HTTP calls tracing
new Integrations.Http({tracing: true}),
Expand Down
2 changes: 1 addition & 1 deletion src/util/polyfill/polyfill-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function getPolyfillSetIdentifier(polyfills: Set<PolyfillFeatureInput>, c
* Returns true if the given polyfill should be included for a particular user agent
*/
function shouldIncludePolyfill(force: boolean, context: PolyfillContext, userAgent: string | undefined, features: string[], supportedContexts: Set<PolyfillContext>): boolean {
return supportedContexts.has(context) && (force || features.length < 1 || userAgent == null || !userAgentSupportsFeatures(userAgent, ...features));
return supportedContexts.has(context) && (force || features.length < 1 || (userAgent != null && !userAgentSupportsFeatures(userAgent, ...features)));
}

/**
Expand Down

0 comments on commit 7f5b1ec

Please sign in to comment.