Skip to content

Commit

Permalink
chore(output-targets): soft-remove the dist-custom-elements-bundle… (#…
Browse files Browse the repository at this point in the history
…3579)

This soft-removes the dist-custom-elements-bundle output target by
removing it from our list of valid output targets and fixing the few
issues that causes w/ tests, type checking, etc.

This also adds TODO(STENCIL-561) comments that (hopefully) point out the
main places we'll need to delete code later one when we tear the whole
thing out all the way.

STENCIL-260: Soft Removal of dist-custom-elements-bundle
  • Loading branch information
alicewriteswrongs authored and rwaskiewicz committed Jan 23, 2023
1 parent e982938 commit f2c242b
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 27 deletions.
4 changes: 0 additions & 4 deletions src/compiler/config/outputs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export const validateOutputTargets = (config: d.ValidatedConfig, diagnostics: d.
err.messageText = `Invalid outputTarget type "${
outputTarget.type
}". Valid outputTarget types include: ${VALID_CONFIG_OUTPUT_TARGETS.map((t) => `"${t}"`).join(', ')}`;
} else if (outputTarget.type === DIST_CUSTOM_ELEMENTS_BUNDLE) {
// TODO(STENCIL-260): Remove this check when the 'dist-custom-elements-bundle' is removed
const warning = buildWarn(diagnostics);
warning.messageText = `dist-custom-elements-bundle is deprecated and will be removed in a future major version release. Use "dist-custom-elements" instead. If "dist-custom-elements" does not meet your needs, please add a comment to https://github.com/ionic-team/stencil/issues/3136.`;
}
});

Expand Down
13 changes: 0 additions & 13 deletions src/compiler/config/test/validate-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,6 @@ describe('validation', () => {
expect(validated.diagnostics).toHaveLength(1);
});

it('should warn when dist-custom-elements-bundle is found', () => {
userConfig.outputTargets = [
{
type: 'dist-custom-elements-bundle',
},
];
const validated = validateConfig(userConfig, bootstrapConfig);
expect(validated.diagnostics).toHaveLength(1);
expect(validated.diagnostics[0].messageText).toBe(
'dist-custom-elements-bundle is deprecated and will be removed in a future major version release. Use "dist-custom-elements" instead. If "dist-custom-elements" does not meet your needs, please add a comment to https://github.com/ionic-team/stencil/issues/3136.'
);
});

it('should default outputTargets with www', () => {
const { config } = validateConfig(userConfig, bootstrapConfig);
expect(config.outputTargets.some((o) => o.type === 'www')).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO(STENCIL-561): move this into ../dist-custom-elements and rename things accordingly
import type * as d from '../../../declarations';
import { getBuildFeatures, updateBuildConditionals } from '../../app-core/app-data';

Expand Down
3 changes: 2 additions & 1 deletion src/compiler/output-targets/output-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const isOutputTargetDistCollection = (o: d.OutputTarget): o is d.OutputTa
export const isOutputTargetDistCustomElements = (o: d.OutputTarget): o is d.OutputTargetDistCustomElements =>
o.type === DIST_CUSTOM_ELEMENTS;

// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
export const isOutputTargetDistCustomElementsBundle = (
o: d.OutputTarget
): o is d.OutputTargetDistCustomElementsBundle => o.type === DIST_CUSTOM_ELEMENTS_BUNDLE;
Expand Down Expand Up @@ -73,6 +74,7 @@ export const CUSTOM = 'custom';
export const DIST = 'dist';
export const DIST_COLLECTION = 'dist-collection';
export const DIST_CUSTOM_ELEMENTS = 'dist-custom-elements';
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
export const DIST_CUSTOM_ELEMENTS_BUNDLE = 'dist-custom-elements-bundle';

export const DIST_TYPES = 'dist-types';
Expand Down Expand Up @@ -101,7 +103,6 @@ export const VALID_CONFIG_OUTPUT_TARGETS = [
DIST,
DIST_COLLECTION,
DIST_CUSTOM_ELEMENTS,
DIST_CUSTOM_ELEMENTS_BUNDLE,
DIST_LAZY,
DIST_HYDRATE_SCRIPT,

Expand Down
1 change: 1 addition & 0 deletions src/compiler/types/tests/validate-package-json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe('validate-package-json', () => {
expect(buildCtx.diagnostics).toHaveLength(0);
});

// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
it('validate custom elements bundle module', async () => {
config.outputTargets = [
{
Expand Down
3 changes: 0 additions & 3 deletions test/end-to-end/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export const config: Config = {
{
type: 'dist',
},
{
type: 'dist-custom-elements-bundle',
},
{
type: 'dist-hydrate-script',
},
Expand Down
5 changes: 0 additions & 5 deletions test/end-to-end/test-end-to-end-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ fs.accessSync(path.join(distDir, 'loader'));
fs.accessSync(path.join(distDir, 'index.cjs.js'));
fs.accessSync(path.join(distDir, 'index.js'));

const customElementsDir = path.join(distDir, 'custom-elements');
fs.accessSync(path.join(customElementsDir, 'index.d.ts'));
fs.accessSync(path.join(customElementsDir, 'index.js'));
fs.accessSync(path.join(customElementsDir, 'index.js.map'));

const collectionDir = path.join(distDir, 'collection');
fs.accessSync(path.join(collectionDir, 'car-list', 'car-data.js'));
fs.accessSync(path.join(collectionDir, 'car-list', 'car-data.js.map'));
Expand Down
1 change: 0 additions & 1 deletion test/hello-world/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const config: Config = {
namespace: 'HelloWorld',
outputTargets: [
{ type: 'dist' },
{ type: 'dist-custom-elements-bundle' },
{ type: 'dist-hydrate-script' },
{
type: 'www',
Expand Down

0 comments on commit f2c242b

Please sign in to comment.