Skip to content
Permalink
Browse files

feat(config): update config extra defaults

Update the config validation so cssVarsShim, dynamicImportShim, safari10, scriptDataOpts, shadowDomShim and initializeNextTick are not enabled by default. The extras can still be enabled and work the same as Stencil 1, however, they will be opt-in now and need to be set to true, rather than the default.
  • Loading branch information
adamdbradley committed Aug 4, 2020
1 parent 1973032 commit 363bf59fc9212a771a766c21909263d6c4ccdf18
Showing with 21 additions and 6 deletions.
  1. +15 −0 src/compiler/config/test/validate-config.spec.ts
  2. +6 −6 src/compiler/config/validate-config.ts
@@ -293,4 +293,19 @@ describe('validation', () => {
const { config } = validateConfig(userConfig);
expect(config.outputTargets.some(o => o.type === 'www')).toBe(true);
});

it('should set extras defaults', () => {
const { config } = validateConfig(userConfig);
expect(config.extras.appendChildSlotFix).toBe(false);
expect(config.extras.cloneNodeFix).toBe(false);
expect(config.extras.cssVarsShim).toBe(false);
expect(config.extras.dynamicImportShim).toBe(false);
expect(config.extras.lifecycleDOMEvents).toBe(false);
expect(config.extras.safari10).toBe(false);
expect(config.extras.scriptDataOpts).toBe(false);
expect(config.extras.shadowDomShim).toBe(false);
expect(config.extras.slotChildNodesFix).toBe(false);
expect(config.extras.initializeNextTick).toBe(false);
expect(config.extras.tagNameTransform).toBe(false);
});
});
@@ -31,14 +31,14 @@ export const validateConfig = (userConfig?: Config) => {
config.extras = config.extras || {};
config.extras.appendChildSlotFix = !!config.extras.appendChildSlotFix;
config.extras.cloneNodeFix = !!config.extras.cloneNodeFix;
config.extras.cssVarsShim = config.extras.cssVarsShim !== false;
config.extras.dynamicImportShim = config.extras.dynamicImportShim !== false;
config.extras.cssVarsShim = !!config.extras.cssVarsShim;
config.extras.dynamicImportShim = !!config.extras.dynamicImportShim;
config.extras.lifecycleDOMEvents = !!config.extras.lifecycleDOMEvents;
config.extras.safari10 = config.extras.safari10 !== false;
config.extras.scriptDataOpts = config.extras.scriptDataOpts !== false;
config.extras.shadowDomShim = config.extras.shadowDomShim !== false;
config.extras.safari10 = !!config.extras.safari10;
config.extras.scriptDataOpts = !!config.extras.scriptDataOpts;
config.extras.shadowDomShim = !!config.extras.shadowDomShim;
config.extras.slotChildNodesFix = !!config.extras.slotChildNodesFix;
config.extras.initializeNextTick = config.extras.initializeNextTick !== false;
config.extras.initializeNextTick = !!config.extras.initializeNextTick;
config.extras.tagNameTransform = !!config.extras.tagNameTransform;

setBooleanConfig(config, 'minifyCss', null, !config.devMode);

0 comments on commit 363bf59

Please sign in to comment.
You can’t perform that action at this time.