Skip to content

refactor: move version export to core entry-point #15700

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/core/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

export * from './version';
export * from './animation/animation';
export * from './common-behaviors/index';
export * from './datetime/index';
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

export * from './version';
export * from '@angular/material/autocomplete';
export * from '@angular/material/badge';
export * from '@angular/material/bottom-sheet';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {join} from 'path';

describe('v8 material imports', () => {

function writeSecondaryEntryPoint(materialPath: string, name: string) {
function writeSecondaryEntryPoint(materialPath: string, name: string, exportName = name) {
const entryPointPath = join(materialPath, name);
mkdirpSync(entryPointPath);
writeFileSync(join(entryPointPath, 'index.d.ts'), `export const ${name} = '';`);
writeFileSync(join(entryPointPath, 'index.d.ts'), `export const ${exportName} = '';`);
}

it('should report imports for deleted animation constants', async () => {
Expand All @@ -21,11 +21,13 @@ describe('v8 material imports', () => {
export * from './a';
export * from './b';
export * from './c';
export * from './core';
`);

writeSecondaryEntryPoint(materialPath, 'a');
writeSecondaryEntryPoint(materialPath, 'b');
writeSecondaryEntryPoint(materialPath, 'c');
writeSecondaryEntryPoint(materialPath, 'core', 'VERSION');

await runFixers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ import { b } from "@angular/material/b";
import { c } from "@angular/material/c";

import { /* comment */ a as a3 } from "@angular/material/a";

// primary entry-point export
import { VERSION } from "@angular/material/core";
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ import {a as a2} from '@angular/material';
import {c, b, a} from '@angular/material';

import {/* comment */ a as a3} from '@angular/material';

// primary entry-point export
import {VERSION} from '@angular/material';

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,13 @@ function walk(ctx: Lint.WalkContext<boolean>, checker: ts.TypeChecker): void {

// Determine the subpackage each symbol in the namedBinding comes from.
for (const element of declaration.importClause.namedBindings.elements) {
// Ensure the import specifier name is statically analyzable.
if (!ts.isIdentifier(element.name)) {
return ctx.addFailureAtNode(element, element.getText() + Rule.SYMBOL_NOT_FOUND_FAILURE_STR);
}
const elementName = element.propertyName ? element.propertyName : element.name;

// Get the symbol for the named binding element. Note that we cannot determine the
// value declaration based on the type of the element as types are not necessarily
// specific to a given secondary entry-point (e.g. exports with the type of "string")
// would resolve to the module types provided by TypeScript itself.
const symbol = getDeclarationSymbolOfNode(element.name, checker);
const symbol = getDeclarationSymbolOfNode(elementName, checker);

// If the symbol can't be found, add failure saying the symbol
// can't be found.
Expand Down
2 changes: 2 additions & 0 deletions tools/public_api_guard/lib/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,5 @@ export declare class ShowOnDirtyErrorStateMatcher implements ErrorStateMatcher {
}

export declare type ThemePalette = 'primary' | 'accent' | 'warn' | undefined;

export declare const VERSION: Version;
1 change: 0 additions & 1 deletion tools/public_api_guard/lib/lib.d.ts
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
export declare const VERSION: Version;