Skip to content
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

chore(output-targets): soft-remove the dist-custom-elements-bundle… #3579

Merged
merged 10 commits into from
Sep 6, 2022
12 changes: 2 additions & 10 deletions src/compiler/config/outputs/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import type * as d from '../../../declarations';
import { buildError, buildWarn } from '@utils';
import {
DIST_CUSTOM_ELEMENTS_BUNDLE,
isValidConfigOutputTarget,
VALID_CONFIG_OUTPUT_TARGETS,
} from '../../output-targets/output-utils';
import { buildError } from '@utils';
import { isValidConfigOutputTarget, VALID_CONFIG_OUTPUT_TARGETS } from '../../output-targets/output-utils';
import { validateCollection } from './validate-collection';
import { validateCustomElement } from './validate-custom-element';
import { validateCustomOutput } from './validate-custom-output';
Expand All @@ -25,10 +21,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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
import type * as d from '../../../declarations';
import { COPY, isOutputTargetDistCustomElementsBundle } from '../../output-targets/output-utils';
import { getAbsolutePath } from '../config-utils';
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 @@ -344,19 +344,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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
import type * as d from '../../../declarations';
import { isOutputTargetDistCustomElementsBundle } from '../output-utils';
import { dirname, join, relative } from 'path';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
import type * as d from '../../../declarations';
import type { BundleOptions } from '../../bundle/bundle-interface';
import { bundleOutput } from '../../bundle/bundle-output';
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 @@ -27,6 +27,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 @@ -72,6 +73,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 @@ -100,7 +102,6 @@ export const VALID_CONFIG_OUTPUT_TARGETS = [
DIST,
DIST_COLLECTION,
DIST_CUSTOM_ELEMENTS,
DIST_CUSTOM_ELEMENTS_BUNDLE,
DIST_LAZY,
DIST_HYDRATE_SCRIPT,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as outputCustomElementsMod from '../dist-custom-elements';
import { OutputTargetDistCustomElements } from '../../../declarations';
import { stubComponentCompilerMeta } from '../../types/tests/ComponentCompilerMeta.stub';
import { STENCIL_APP_GLOBALS_ID, STENCIL_INTERNAL_CLIENT_ID, USER_INDEX_ENTRY_ID } from '../../bundle/entry-alias-ids';
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
import { DIST_CUSTOM_ELEMENTS, DIST_CUSTOM_ELEMENTS_BUNDLE } from '../output-utils';

const setup = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/types/tests/validate-package-json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type * as d from '@stencil/core/declarations';
import { mockBuildCtx, mockCompilerCtx, mockValidatedConfig } from '@stencil/core/testing';
import * as v from '../validate-build-package-json';
import path from 'path';
// TODO(STENCIL-561): fully delete dist-custom-elements-bundle code
import { DIST_COLLECTION, DIST_CUSTOM_ELEMENTS, DIST_CUSTOM_ELEMENTS_BUNDLE } from '../../output-targets/output-utils';
import { normalizePath } from '../../../utils/normalize-path';

Expand Down Expand Up @@ -92,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
14 changes: 11 additions & 3 deletions test/todo-app/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ export namespace Components {
"text": string;
}
}
export interface TodoInputCustomEvent<T> extends CustomEvent<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this change get triggered by other things in the PR? Or is this a case of us (me) merging main into this branch and not running a build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, I meant to point this out / ask

I had some test failures I had to work through with the test.analysis npm script, and running it locally led to these changes. Should we commit them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what happened here. These should have been committed a while ago 😨

My vote is we split them out into a separate PR. Can you do me a favor and create a branch off of v3.0.0-dev and run npm run build in the test dir? That should be enough to replicate these changes. While we're there, it may make sense to propagate our check for a dirty git context over to the main CI workflow (the irony being, IIRC, that's where we originally had it in the first implementation PR before I asked for it only to be in Browserstack 🤦 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha ok sure, will do, and I'll delete the file here 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detail: T;
target: HTMLTodoInputElement;
}
export interface TodoItemCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLTodoItemElement;
}
declare global {
interface HTMLAppRootElement extends Components.AppRoot, HTMLStencilElement {
}
Expand Down Expand Up @@ -44,12 +52,12 @@ declare namespace LocalJSX {
interface AppRoot {
}
interface TodoInput {
"onInputSubmit"?: (event: CustomEvent<any>) => void;
"onInputSubmit"?: (event: TodoInputCustomEvent<any>) => void;
}
interface TodoItem {
"checked"?: boolean;
"onItemCheck"?: (event: CustomEvent<any>) => void;
"onItemRemove"?: (event: CustomEvent<any>) => void;
"onItemCheck"?: (event: TodoItemCustomEvent<any>) => void;
"onItemRemove"?: (event: TodoItemCustomEvent<any>) => void;
"text"?: string;
}
interface IntrinsicElements {
Expand Down