Skip to content
Open
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
4 changes: 4 additions & 0 deletions scripts/check-esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ try {
: ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument)
? node.argument.literal
: undefined;
// The root is Ionic lazy-loader build. Bundlers then emit every component as a chunk, and apps get a second gesture controller.
if (specifier && ts.isStringLiteral(specifier) && !declaration) {
assert.notEqual(specifier.text, '@ionic/core', `${relative}: import from @ionic/core/components instead of @ionic/core`);
}
if (specifier && ts.isStringLiteral(specifier) && specifier.text.startsWith('.')) {
assert.ok(specifier.text.endsWith('.js'), `${relative}: missing .js extension in ${specifier.text}`);
const target = declaration ? specifier.text.replace(/\.js$/, '.d.ts') : specifier.text;
Expand Down
6 changes: 6 additions & 0 deletions scripts/check-esm.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ test('imports subpath entry points and catches import-time DOM access', () => {
assert.match(result.output, /document is not defined/);
});

test('rejects runtime imports from the @ionic/core root', () => {
const result = run(fixture('ionic-root', { native: "export { createAnimation } from '@ionic/core';" }));
assert.notEqual(result.status, 0);
assert.match(result.output, /native\.js: import from @ionic\/core\/components instead of @ionic\/core/);
});

test('rejects extensionless references in declarations', () => {
const directory = fixture('declaration');
writeFileSync(join(directory, 'dist/index.d.ts'), "export type Value = import('./detail').Value;");
Expand Down
4 changes: 2 additions & 2 deletions src/popover/animations/ios.enter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAnimation } from '@ionic/core';
import type { Animation } from '@ionic/core';
import { createAnimation } from '@ionic/core/components';
import type { Animation } from '@ionic/core/components';
import { calculateWindowAdjustment, getPopoverDimensions, getPopoverPosition, POPOVER_IOS_BODY_MARGIN } from '../utils.js';
import { createCalloutSurface } from '../callout-surface.js';
import { getElementRoot } from '../../dom.js';
Expand Down
4 changes: 2 additions & 2 deletions src/popover/animations/ios.leave.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createAnimation } from '@ionic/core';
import { createAnimation } from '@ionic/core/components';
import { getElementRoot } from '../../dom.js';

import type { Animation } from '@ionic/core';
import type { Animation } from '@ionic/core/components';

/**
* iOS Popover Leave Animation
Expand Down
2 changes: 1 addition & 1 deletion src/popover/popover-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Mode, OverlayInterface } from '@ionic/core';
import type { AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Mode, OverlayInterface } from '@ionic/core/components';

export interface PopoverInterface extends OverlayInterface {
present: (event?: MouseEvent | TouchEvent | PointerEvent) => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IonicConfig } from '@ionic/core';
import type { IonicConfig } from '@ionic/core/components';
import type { AnimationPosition } from './sheets-of-glass.js';

export const cloneElement = (tagName: string, useCache: boolean = true): HTMLElement => {
Expand Down
4 changes: 2 additions & 2 deletions src/transition/ios.transition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Animation } from '@ionic/core';
import { createAnimation } from '@ionic/core';
import type { Animation } from '@ionic/core/components';
import { createAnimation } from '@ionic/core/components';

/** Options consumed by the shared iOS page transition animation. */
export interface IosTransitionAnimationOptions {
Expand Down