Skip to content

Commit a380947

Browse files
alicewriteswrongsrwaskiewicz
authored andcommitted
chore(config): mark extras.safari10 field as deprecated (#3899)
Stencil v3 will deprecate support for Safari 10, so we no longer need to support this option. This commit marks it as deprecated, as a preparation for removing it later. BREAKING CHANGES: the `safari10` field is now deprecated. Support for Safari 10 has been dropped.
1 parent f67fc6c commit a380947

14 files changed

+45
-9
lines changed

BREAKING_CHANGES.md

+21-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ This is a comprehensive list of the breaking changes introduced in the major ver
1616
* [`dist-custom-elements` Type Declarations](#dist-custom-elements-type-declarations)
1717
* [Legacy Browser Support Fields Deprecated](#legacy-browser-support-fields-deprecated)
1818
* [`dynamicImportShim`](#dynamicimportshim)
19-
* [`cssVarShim`](#cssvarshim)
19+
* [`cssVarsShim`](#cssvarsshim)
2020
* [`shadowDomShim`](#shadowdomshim)
21+
* [`safari10`](#safari10)
2122
* [Deprecated `assetsDir` Removed from `@Component()` decorator](#deprecated-assetsdir-removed-from-component-decorator)
2223
* [Drop Node 12 Support](#drop-node-12-support)
2324
* [Strongly Typed Inputs](#strongly-typed-inputs)
@@ -100,9 +101,9 @@ export const config: Config = {
100101
};
101102
```
102103

103-
##### `cssVarShim`
104+
##### `cssVarsShim`
104105

105-
`extras.cssVarShim` causes Stencil to include a polyfill for [CSS
106+
`extras.cssVarsShim` causes Stencil to include a polyfill for [CSS
106107
variables](https://developer.mozilla.org/en-US/docs/Web/CSS/--*). For Stencil
107108
v3.0.0 this field is renamed to `__deprecated__cssVarsShim`. To retain the
108109
previous behavior the new option can be set in your project's
@@ -139,6 +140,23 @@ export const config: Config = {
139140
};
140141
```
141142

143+
##### `safari10`
144+
145+
If `extras.safari10` is set to `true` the Stencil runtime will patch ES module
146+
support for Safari 10. In Stencil v3.0.0 the field is renamed to
147+
`__deprecated__safari10` to indicate deprecation. To retain the prior behavior
148+
the new option can be set in your project's `stencil.config.ts`:
149+
150+
```ts
151+
// stencil.config.ts
152+
import { Config } from '@stencil/core';
153+
export const config: Config = {
154+
extras: {
155+
__deprecated__safari10: true
156+
}
157+
};
158+
```
159+
142160
#### Deprecated `assetsDir` Removed from `@Component()` decorator
143161
The `assetsDir` field was [deprecated in Stencil v2.0.0](#componentassetsdir), but some backwards compatibility was retained with a warning message.
144162
It has been fully removed in Stencil v3.0.0 in favor of `assetsDirs`.

src/app-data/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const BUILD: BuildConditionals = {
6363
cloneNodeFix: false,
6464
hydratedAttribute: false,
6565
hydratedClass: true,
66+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
6667
safari10: false,
6768
scriptDataOpts: false,
6869
scopedSlotTextContentFix: false,

src/client/client-patch-browser.ts

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const patchBrowser = (): Promise<d.CustomElementsDefineOptions> => {
3737
// @ts-ignore
3838
const scriptElm =
3939
// TODO(STENCIL-661): Remove code related to the dynamic import shim
40+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
4041
BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
4142
? Array.from(doc.querySelectorAll('script')).find(
4243
(s) =>
@@ -47,6 +48,7 @@ export const patchBrowser = (): Promise<d.CustomElementsDefineOptions> => {
4748
const importMeta = import.meta.url;
4849
const opts = BUILD.scriptDataOpts ? (scriptElm as any)['data-opts'] || {} : {};
4950

51+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
5052
if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
5153
// Safari < v11 support: This IF is true if it's Safari below v11.
5254
// This fn cannot use async/await since Safari didn't support it until v11,
@@ -62,9 +64,11 @@ export const patchBrowser = (): Promise<d.CustomElementsDefineOptions> => {
6264
} as any;
6365
}
6466

67+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
6568
if (!BUILD.safari10 && importMeta !== '') {
6669
opts.resourcesUrl = new URL('.', importMeta).href;
6770
// TODO(STENCIL-661): Remove code related to the dynamic import shim
71+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
6872
} else if (BUILD.dynamicImportShim || BUILD.safari10) {
6973
opts.resourcesUrl = new URL(
7074
'.',

src/compiler/app-core/app-data.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ export const updateBuildConditionals = (config: Config, b: BuildConditionals) =>
152152
// TODO(STENCIL-661): Remove code related to the dynamic import shim
153153
b.dynamicImportShim = config.extras.__deprecated__dynamicImportShim;
154154
b.lifecycleDOMEvents = !!(b.isDebug || config._isTesting || config.extras.lifecycleDOMEvents);
155-
b.safari10 = config.extras.safari10;
155+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
156+
b.safari10 = config.extras.__deprecated__safari10;
156157
b.scopedSlotTextContentFix = !!config.extras.scopedSlotTextContentFix;
157158
b.scriptDataOpts = config.extras.scriptDataOpts;
158159
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field

src/compiler/config/test/validate-config.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ describe('validation', () => {
359359
// TODO(STENCIL-661): Remove code related to the dynamic import shim
360360
expect(config.extras.__deprecated__dynamicImportShim).toBe(false);
361361
expect(config.extras.lifecycleDOMEvents).toBe(false);
362-
expect(config.extras.safari10).toBe(false);
362+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
363+
expect(config.extras.__deprecated__safari10).toBe(false);
363364
expect(config.extras.scriptDataOpts).toBe(false);
364365
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
365366
expect(config.extras.__deprecated__shadowDomShim).toBe(false);

src/compiler/config/validate-config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export const validateConfig = (
7676
// TODO(STENCIL-661): Remove code related to the dynamic import shim
7777
validatedConfig.extras.__deprecated__dynamicImportShim = !!validatedConfig.extras.__deprecated__dynamicImportShim;
7878
validatedConfig.extras.lifecycleDOMEvents = !!validatedConfig.extras.lifecycleDOMEvents;
79-
validatedConfig.extras.safari10 = !!validatedConfig.extras.safari10;
79+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
80+
validatedConfig.extras.__deprecated__safari10 = !!validatedConfig.extras.__deprecated__safari10;
8081
validatedConfig.extras.scriptDataOpts = !!validatedConfig.extras.scriptDataOpts;
8182
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
8283
validatedConfig.extras.__deprecated__shadowDomShim = !!validatedConfig.extras.__deprecated__shadowDomShim;

src/compiler/optimize/optimize-js.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const optimizeJs = async (inputOpts: OptimizeJsInput) => {
1515
const prettyOutput = !!inputOpts.pretty;
1616
const config: Config = {
1717
extras: {
18-
safari10: true,
18+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
19+
__deprecated__safari10: true,
1920
},
2021
};
2122
const sourceTarget = inputOpts.target === 'es5' ? 'es5' : 'latest';

src/compiler/optimize/optimize-module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ export const optimizeModule = async (
128128
export const getTerserOptions = (config: Config, sourceTarget: SourceTarget, prettyOutput: boolean): MinifyOptions => {
129129
const opts: MinifyOptions = {
130130
ie8: false,
131-
safari10: !!config.extras.safari10,
131+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
132+
safari10: !!config.extras.__deprecated__safari10,
132133
format: {},
133134
sourceMap: config.sourceMap,
134135
};

src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const getHydrateBuildConditionals = (config: d.ValidatedConfig, cmps: d.Componen
136136
build.cloneNodeFix = false;
137137
build.appendChildSlotFix = false;
138138
build.slotChildNodesFix = false;
139+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
139140
build.safari10 = false;
140141
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
141142
build.shadowDomShim = false;

src/compiler/output-targets/dist-hydrate-script/hydrate-build-conditionals.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const getHydrateBuildConditionals = (cmps: d.ComponentCompilerMeta[]) =>
2727
build.cssAnnotations = true;
2828
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2929
build.shadowDomShim = true;
30+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
3031
build.safari10 = false;
3132
build.hydratedAttribute = false;
3233
build.hydratedClass = true;

src/declarations/stencil-private.ts

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export interface BuildConditionals extends Partial<BuildFeatures> {
181181
hydratedAttribute?: boolean;
182182
hydratedClass?: boolean;
183183
initializeNextTick?: boolean;
184+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
184185
safari10?: boolean;
185186
scriptDataOpts?: boolean;
186187
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field

src/declarations/stencil-public-compiler.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,16 @@ export interface ConfigExtras {
299299
*/
300300
lifecycleDOMEvents?: boolean;
301301

302+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
302303
/**
303304
* Safari 10 supports ES modules with `<script type="module">`, however, it did not implement
304305
* `<script nomodule>`. When set to `true`, the runtime will patch support for Safari 10
305306
* due to its lack of `nomodule` support.
306307
* Defaults to `false`.
308+
*
309+
* @deprecated Since Stencil v3.0.0, Safari 10 is no longer supported.
307310
*/
308-
safari10?: boolean;
311+
__deprecated__safari10?: boolean;
309312

310313
/**
311314
* It is possible to assign data to the actual `<script>` element's `data-opts` property,

src/testing/reset-build-conditionals.ts

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export function resetBuildConditionals(b: d.BuildConditionals) {
4141
// TODO(STENCIL-661): Remove code related to the dynamic import shim
4242
b.dynamicImportShim = false;
4343
b.hotModuleReplacement = false;
44+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
4445
b.safari10 = false;
4546
b.scriptDataOpts = false;
4647
b.scopedSlotTextContentFix = false;

src/testing/spec-page.ts

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export async function newSpecPage(opts: NewSpecPageOptions): Promise<SpecPage> {
130130
BUILD.cloneNodeFix = false;
131131
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
132132
BUILD.shadowDomShim = false;
133+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
133134
BUILD.safari10 = false;
134135
BUILD.attachStyles = !!opts.attachStyles;
135136

0 commit comments

Comments
 (0)